You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Passing first: 0 to findByCursor returns all items.
I have a situation where, in the front-end, I want to just retrieve the total count of items. I don't have an endpoint to just get meta information, so I am just issuing a query to list zero items and then reading the page information. Unfortunately, right now this retrieves all items which is a major performance issue. So as a workaround I am requesting a single item with first: 1.
Since limit: 0 returns zero items, I think first: 0 also should return zero items.
Note that first: 0 shouldn't result in limit 0 but rather to limit 1, as with cursor based pagination we are overfetching by default to know whether there is a next page. You can disable that via overfetch: false.
Describe the bug
Passing
first: 0
tofindByCursor
returns all items.I have a situation where, in the front-end, I want to just retrieve the total count of items. I don't have an endpoint to just get meta information, so I am just issuing a query to list zero items and then reading the page information. Unfortunately, right now this retrieves all items which is a major performance issue. So as a workaround I am requesting a single item with
first: 1
.Since
limit: 0
returns zero items, I thinkfirst: 0
also should return zero items.Reproduction
https://github.com/stefansundin/mikro-orm-reproduction/tree/first-0
What driver are you using?
@mikro-orm/postgresql
MikroORM version
6.2.1
Node.js version
18.20.2
Operating system
No response
Validations
The text was updated successfully, but these errors were encountered: