The error is: the update operation document must contain atomic operators.
db.get().collection('users').updateOne(query, newvalues, function (err, result) {
cb(err,result)
})
I already use the $set operator. I just printed on the console both query and newvalues and i cant find any mistake.
query: { username: 'macarra' }
newvalues: { $set: {name: "Mojo Picon",email: "[email protected]"} }
If you have the object with the new values:
var obj = {
name: "Mojo Picon",
email: "[email protected]"
}
to build the newvalues object required by the updateOne method you need to:
var newvalues = {
$set: obj
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With