Recently, I've been utilizing the query builder feature provided by typeorm.
It has been functioning perfectly with my use of the where
function as well as the take
function. When using the where
function alone, it correctly retrieves 5 items and when the first value is set to 3
, it retrieves 3 items as expected. However, an issue arises when using both functions simultaneously. In this scenario, it only returns one item consistently. Can anyone pinpoint what mistake I might be making?
public async search(first?: number): Promise<Item[]> {
const findConditions: FindConditions<Item> = {
deleted: IsNull(),
};
return this.itemRepository
.createQueryBuilder()
.select("item")
.from(Item, "item")
.where(findConditions)
.take(first)
.getMany();
}