-
-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting limit
while using findAndCount()
always returns one result even if more are available
#2867
Comments
Please always upgrade to latest before filing issues, and note that you are supposed to say what exact versions are you using - so not a range, an exact version. This has been fixed in v5.0.5. |
I might be doing something wrong but I just upgraded to 5.0.5 and purged
I can see this generated query returning 10 of the same row with the same
Versions
|
Can you try this? const [results, count]= await this.fooRepository.findAndCount(
{
$and: [{ organization: organization }, {}],
},
{
limit: 5,
flags: [QueryFlag.PAGINATE],
},
);
console.log(results.length, count); The query needs to be a subquery, which is what the paginate flag does. It should be applied automatically in latest version, but apparently only when using QB directly. |
Yeah that works. Interesting. Thank you. |
Ok let's reopen then, this should work automatically nowadays. |
Describe the bug
Setting
limit
while usingfindAndCount
always returns one result even if more are available.To Reproduce
Steps to reproduce the behavior:
Output: 1 7
Generated SQL
Expected behavior
Limit should return up to 5 items if they are available not one.
Additional context
Removing
limit
returns all 8 results.Versions
The text was updated successfully, but these errors were encountered: