Answer the question
In order to leave comments, you need to log in
How to make a multi update in MongoDB, by a given parameter?
Unfortunately, the official documentation is not clear to me yet.
I have the following problem:
There is a database of records, about 1000 records in the following form:
{
"name": "john",
"age" : 25,
"role": 1
}
{
"name": "john",
"role": 3
}
Answer the question
In order to leave comments, you need to log in
db.collection.update({ 'name': "john"}, { $set: { 'role': 3}}, { multi: true})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question