-
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
Mongoose plugin does not cast the query before execution #312
Comments
@vkarpov15 might know |
Please help with this @bradvogel @jsalvata |
@dmarinere I'm sorry, I don't know Mongoose well. I haven't used it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I came across this issue today when querying a Mongoose schema with a ref and ObjectId to another collection.
Usually, Mongoose will cast the query before execution, and convert all ObjectId properties to ObjectIds before executing the query. When using the mongoose plugin, this does not happen, so fields that should be ObjectIds are instead queried as strings. The outcome is that no documents will be found.
Example:
The mongoose plugin should ideally cast the query before executing the find method. For example, the following casting works before executing the query:
Having the mongoose plugin handle this internally would likely be a good enhancement, so all of the Mongoose special sauce is handled ahead of the query on the collection.
The text was updated successfully, but these errors were encountered: