-
Notifications
You must be signed in to change notification settings - Fork 92
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
TotalDocs returning 0 while there is result #39
Comments
@yuqing630 Can you share the query used in filters. The format is: Model.paginate([query], [options], [callback]) |
|
@yuqing630 Can you try this in the new version. |
ok will do |
Hi @aravindnc. I ran into a similar problem. If in the option add
My query looks like this: then the number of documents is calculated incorrectly, it seems that because when the counting of the found documents is in progress, the collation does not apply mongoose-paginate-v2/src/index.js Line 105 in 05a8a98
The idea should be like this: const countPromise = this.find(query).collation(collation).exec();
|
@ingvarr6 I've just tested with 1,00,000 rows of data and it is working fine with v1.3.1. |
@ingvarr6 I've added collation to the new version. Thanks for pointing out. |
@yuqing630 @ingvarr6 Please feel to reopen this thread if the issue exists. |
I'm seeing the same problem as @ingvarr6 with version 1.3.14. When I ensured the collation is applied before the |
somthing.paginate(filters, options, (error, result) => {
if (error) {
errorHandler(res, error);
} else {
res.status(statuses("ok")).send({
result.docs,
result.totalDocs
});
}
option={ populate: [ 'images' ],
sort: { 'date.created': 'desc' },
limit: 100,
offset: 0 }
mongoose version
"mongoose": "~5.6.9",
"mongoose-paginate-v2": "^1.3.0",
as you can see from the screen shot they are returning 2 result but the total docs 0
The text was updated successfully, but these errors were encountered: