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
New version error #10624
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Comments
IslandRhythms
added
the
needs clarification
This issue doesn't have enough information to be actionable. Close after 14 days of inactivity
label
Aug 27, 2021
Please include the code that is throwing the error |
|
vkarpov15
added
needs repro script
Maybe a bug, but no repro script. The issue reporter should create a script that demos the issue
and removed
needs clarification
This issue doesn't have enough information to be actionable. Close after 14 days of inactivity
labels
Aug 27, 2021
IslandRhythms
added
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
and removed
needs repro script
Maybe a bug, but no repro script. The issue reporter should create a script that demos the issue
labels
Aug 27, 2021
I'm getting the same thing when I run it on mongoose latest const mongoose = require('mongoose');
const testSchema = new mongoose.Schema({
Id: String,
Auth: {type: Boolean, default: false},
Usage: {type: Object, default: {} }
});
const Test = mongoose.model('Test', testSchema);
async function test() {
await mongoose.connect('mongodb://localhost:27017/test', {
useNewUrlParser: true,
useUnifiedTopology: true,
});
await mongoose.connection.dropDatabase();
await Test.updateOne({ Id: '12344566', Auth: true}, { $inc: {"Usage.Man": 1 } }, {upsert:true})
console.log('Done');
}
test(); |
Thank you, its works, have a good night :) |
To work around this, set await Test.updateOne({ Id: '12344566', Auth: true}, { $inc: {"Usage.Man": 1 } }, {
upsert:true,
setDefaultsOnInsert: false // Tell mongoose to not add `$setOnInsert: { Usage: {} }` to the update
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why this error? no errors in older versions
The text was updated successfully, but these errors were encountered: