I want to replace some document entirely with multi:true option.
db.user.find().pretty();
{
"_id" : ObjectId("5799b106d15203df993935d9"),
"name" : "zhangyun",
"age" : 33
}
{
"_id" : ObjectId("5799b4d9e21ce60703d1e1c7"),
"name" : "zhangli",
"age" : 12
}
{
"_id" : ObjectId("5799b5afe21ce60703d1e1c8"),
"name" : "zhangyun",
"height" : 1.75
}
I want to do update operation.like this:
db.user.update({name:"zhangyun"},{sex:"male"},{multi:true})
I got "multi update only works with $ operators" error
the mongodb official document
https://docs.mongodb.com/manual/reference/method/db.collection.update/#multi-parameter just tell me it cannot,but no why and how to do in such cases.
can anybody help me with this problem ?