I want to update a set of data.
"records" : [{
"_id" : ObjectId("5a2e23c750cafa52eaae710d"),
"createdTime" : "2017-12-11 14:20",
"jine" : 1500,
"beizhu":"This is a test"
},
{
"_id" : ObjectId("5a2e23c750cafa52eaae710e"),
"createdTime" : "2017-12-11 14:25",
"jine" : 1500,
"beizhu":"This is a test2"
}],
For example, I want to update all data with _id 5a2e23c750cafa52eaae710d. if only jine is updated, I understand.
Bill.update({'_id':ObjectId("5a2e23c750cafa52eaae710d")},{$set:{"records.$.jine":200}})
However, it is unclear to update all the data. Please advise. If the key value of the object has only 2 or 3 items, it is easy to say. But what if there are several? If, simply update all the data?
It has been settled.