-
Notifications
You must be signed in to change notification settings - Fork 72
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
Ignores Schema if used as Mongoose Plugin #47
Comments
If you need just the mongoose plugin which will use your mongoose model, you can try this lib: https://github.com/uncledent/mongoose-cursor-pagination-plugin It is fully based on this library, but there is the mongoose plugin only, other stuff is removed. It uses mongoose model instead of raw mongo driver. |
I have tried your plugin but I face another problem. When I use with nestjs, I have to declare the model while injecting:
In your plugin there is no PaginateModel so the nest can not work, do you have another solution for this? I really need to make the virtual works. |
@sangdth You can just create an interface by your own and use it:
|
Before we used the collection instead of the model As a result all the goodness of mongoose is lost For instance * queries are not casted to the schema, e.g. strings are not converted to ObjectIDs * Simple objects are returned instead of mongoose Documents Replace object-path get with dot-prop get Because object-path only return own properties https://github.com/mariocasciaro/object-path/blob/v0.11.0/index.js#L233 and mongoose _id properties are inherited from the Document use object-path will return undefined instead This should probably fix: mixmaxhq#47 BREAKING CHANGE: This changes the behavior of the mongoose plugin thoroughly squash
Before we used the collection instead of the model As a result all the goodness of mongoose is lost For instance * queries are not casted to the schema, e.g. strings are not converted to ObjectIDs * Simple objects are returned instead of mongoose Documents Replace object-path get with dot-prop get Because object-path only return own properties https://github.com/mariocasciaro/object-path/blob/v0.11.0/index.js#L233 and mongoose _id properties are inherited from the Document use object-path will return undefined instead This should probably fix: mixmaxhq#47 BREAKING CHANGE: This changes the behavior of the mongoose plugin thoroughly squash
It ignores virtuals and hidden fields with { select: false }.
Does anyone know a workaround for that?
The text was updated successfully, but these errors were encountered: