mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
12 lines
239 B
JavaScript
12 lines
239 B
JavaScript
|
|
||
|
t = db.update_addToSet2
|
||
|
t.drop();
|
||
|
|
||
|
o = { _id : 1 }
|
||
|
t.insert( { _id : 1 } );
|
||
|
|
||
|
t.update({},{$addToSet : {'kids' :{ 'name' : 'Bob', 'age': '4'}}})
|
||
|
t.update({},{$addToSet : {'kids' :{ 'name' : 'Dan', 'age': '2'}}})
|
||
|
|
||
|
printjson( t.findOne() );
|