Is there a way to chain static constructor in mongoose ?
In Rails its the way to chain named_scopes
I have a special query to retrieve some data from mongo, but some time I have to apply a limit or to count them.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
[Update] This feature has been removed.
Mongoose has named scope capabilities, but there is an unresolved issue that may indicate they’re not working correctly; check the feature out and see if it works for you. (I will be doing this as well, when I get a chance, as it’s a really nice feature to have!)
The following example code is taken from the named scope test at https://github.com/LearnBoost/mongoose/blob/master/test/namedscope.test.js.