Skip to content

Instantly share code, notes, and snippets.

@RobinStamer
Created July 19, 2011 04:58
Show Gist options
  • Save RobinStamer/1091342 to your computer and use it in GitHub Desktop.
Save RobinStamer/1091342 to your computer and use it in GitHub Desktop.
genoce:PRIMARY> db.test.find()
{ "_id" : ObjectId("4d84b3dfbf83054e8d71d1b9"), "test" : 5, "arr" : [ ] }
{ "_id" : ObjectId("4d881bd683d4b4608fe01a37"), "test" : 4, "arr" : [ 1, 2, 3 ] }
{ "_id" : 1 }
{ "_id" : "asdf" }
genoce:PRIMARY> db.test.update({}, {$set: {x:{}}}, false, true)
genoce:PRIMARY> db.test.find()
{ "_id" : ObjectId("4d84b3dfbf83054e8d71d1b9"), "arr" : [ ], "test" : 5, "x" : { } }
{ "_id" : ObjectId("4d881bd683d4b4608fe01a37"), "arr" : [ 1, 2, 3 ], "test" : 4, "x" : { } }
{ "_id" : 1, "x" : { } }
{ "_id" : "asdf", "x" : { } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment