-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Docs error: wrong parameter order for distinct() #2628
Comments
Well that's embarrassing. Fixed. Thanks for pointing that out. |
Actually, the docs are correct:
But
I never noticed this, its a really bad design decision that predates my involvement in mongoose. Going to fix this now. Unfortunately, its backwards breaking, so it won't go in to 3.8.x. |
MongoDB's APIs use (field, criteria) ( http://docs.mongodb.org/manual/reference/method/db.collection.distinct/ ). I think this order would be the most consistant? Anyways, I'm not sure I understood exactly: what's the final call? What changes now and what will change on 3.0? Thanks for taking care of this |
Mongoose will be consistent with the MongoDB API in 4.0: it will be |
And for now it will be like this?
So the only change in 4.0 is with the |
Yeah exactly. Both cases will be |
The docs ( http://mongoosejs.com/docs/api.html#query_Query-distinct ) say that the parameter order is:
Query#distinct([criteria], [field], [callback])
.After wasting 30 minutes with a very obscure error when using all 3 arguments, I found out that the parameter are actually reversed:
Query#distinct([field], [criteria], [callback])
. This works.The text was updated successfully, but these errors were encountered: