Reputation: 191
I need to insert an array into the specified array subscript. I tried it.
I need push a first array first , then insert an array into the specified array subscript.
db.a.update({_id:1},{$push:{'list':[1]}},upsert=true)
db.a.update({_id:1},{$push:{'list.2':2}},upsert=true)
I used the following a statement is incorrect.
db.a.update({_id:1},{$push:{'list.2':2}},upsert=true)
I want a statement to achieve it. what should I do?
Upvotes: 0
Views: 462