-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
BulkWrite updateOne with filter $elemMatch { $elemMatch: { $in: [] } } throwing TypeError #14678
Closed
2 tasks done
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Comments
Notes: This fallback behavior was recently added for setting schema: The issue arises when cast is called inside castBulkWrite.js with a missing parameter 'context', which would I assume should be model. op['updateOne']['filter'] = cast(model.schema, op['updateOne']['filter'], {
strict: strict,
upsert: op['updateOne'].upsert
}); |
vkarpov15
added
the
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
label
Jun 24, 2024
vkarpov15
added a commit
that referenced
this issue
Jun 24, 2024
vkarpov15
added a commit
that referenced
this issue
Jun 25, 2024
fix: handle casting primitive array with $elemMatch in bulkWrite()
This was referenced Jul 16, 2024
Closed
This was referenced Jul 17, 2024
This was referenced Jul 17, 2024
This was referenced Aug 21, 2024
This was referenced Aug 23, 2024
This was referenced Aug 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
Mongoose version
8.4.3
Node.js version
20.14.0
MongoDB server version
4.4.13
Typescript version (if applicable)
No response
Description
After upgrading mongoose 7.3.4 -> 7.6.13, we started to experience some TypeErrors with one of our bulkWrite operations. We also tried upgrading to 8.4.3, but we still have been facing the same issues.
Error stack:
Steps to Reproduce
Here is a simple script that replicates the error-producing behavior on our backend
Expected Behavior
CASE 1: Filter-matching document found
EXPECTED: ids that don't already exist in document are added to the array ids.
CASE 2: Filter-matching document not found
EXPECTED: A new document is created
The text was updated successfully, but these errors were encountered: