I want to add several items to arrays of several rows in Mongo. How can I do this?
I want to start with this:
{\'x\': \'h\', arr: [1,2,3] }
{\'x\':
If you want to update multiple records, it's important to pass true
as the 4th argument to the update function:
db.test.update( {"name": "x"}, {"$pushAll": {"arr": [1, 2, 3]}}, false, true)
Per the MongoDB shell syntax for update():
db.collection.update( criteria, objNew, upsert, multi )