Wednesday, 15 March 2017

Limit number of results after query population in mongoose

i have a mongoose query in which i limit the number of results to lets say 3 entries. My problem is, that every object gets populated with nested objects. This nested objects have an "active"-flag. I do not want to return any object which have a nested object where the "active"-flag is false, but the population filter is applied after the limit and therefore the result could be empty.

Is it possible to do something like this without executing the query once again with another offset until the limit is reached?



via Tobias Stangl

No comments:

Post a Comment