We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug Whenever you set paginate options on the schema, any toJSON and toObject calls you have won't be called.
To Reproduce Steps to reproduce the behavior:
// THIS: schema.options.toJSON = { transform: (doc, ret) => {console.log("your data", ret); return ret;} }; // OR THIS: schema.method("toJSON", () => {console.log("your data", ret); return ret;});
Run your paginate call like normal, you should see the console log "your data" along with the results.
Then add paginate options prior to adding pagination, it doesn't seem to matter what the options are, you can even set them to a blank object, {}:
mongoosePaginate.paginate.options = { lean: true, customLabels: { totalDocs: "total", totalPages: "pageCount", }, }; // ..... schema.plugin(mongoosePaginate);
Please note, the console log is just for testing, the point is toJSON/toObject never get called if you add any pagination options.
Expected behavior Setting pagination options shouldn't interfere with other calls like toJSON.
Screenshots NA
Desktop (please complete the following information):
Smartphone (please complete the following information): NA
Additional context NA
The text was updated successfully, but these errors were encountered:
I have spent sometime with this, and no idea what's causing this issue.
Sorry, something went wrong.
I am facing this issue also. I am using this plugin with @meanie/mongoose-to-json, but all private fields are leaked.
any update on this? I'm facing the same issue
No branches or pull requests
Describe the bug
Whenever you set paginate options on the schema, any toJSON and toObject calls you have won't be called.
To Reproduce
Steps to reproduce the behavior:
Run your paginate call like normal, you should see the console log "your data" along with the results.
Then add paginate options prior to adding pagination, it doesn't seem to matter what the options are, you can even set them to a blank object, {}:
Please note, the console log is just for testing, the point is toJSON/toObject never get called if you add any pagination options.
Expected behavior
Setting pagination options shouldn't interfere with other calls like toJSON.
Screenshots
NA
Desktop (please complete the following information):
Smartphone (please complete the following information):
NA
Additional context
NA
The text was updated successfully, but these errors were encountered: