Skip to content
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

Map field causes findOneAndUpdate upsert to error #7909

Closed
zackharley opened this issue Jun 18, 2019 · 1 comment
Closed

Map field causes findOneAndUpdate upsert to error #7909

zackharley opened this issue Jun 18, 2019 · 1 comment
Labels
confirmed-bug We've confirmed this is a bug in Mongoose and will fix it.
Milestone

Comments

@zackharley
Copy link

Do you want to request a feature or report a bug?

Report a bug

What is the current behavior?

When using a schema with a field of type Map, attempting to do a findOneAndUpdate with both the setDefaultsOnInsert and upsert fields set to true causes a DollarPrefixedFieldName Mongo Error (code 52). This occurs even when both the findOneAndUpdate condition and update do not reference the Map field.

See Codesandbox Demo.

What is the expected behavior?

The expected fields should be upserted into the DB and any defaults should be set. No error should occur.

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.

Node.js: v10.16.0
Mongoose: v5.6.0
MongoDB: v4.0.10

@vkarpov15 vkarpov15 added this to the 5.6.1 milestone Jun 20, 2019
@vkarpov15 vkarpov15 added the has repro script There is a repro script, the Mongoose devs need to confirm that it reproduces the issue label Jun 20, 2019
vkarpov15 added a commit that referenced this issue Jun 22, 2019
@vkarpov15 vkarpov15 added confirmed-bug We've confirmed this is a bug in Mongoose and will fix it. and removed has repro script There is a repro script, the Mongoose devs need to confirm that it reproduces the issue labels Jun 22, 2019
@zackharley
Copy link
Author

Thanks for fixing this! 🎉 @vkarpov15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug We've confirmed this is a bug in Mongoose and will fix it.
Projects
None yet
Development

No branches or pull requests

2 participants