Skip to content

Instantly share code, notes, and snippets.

@RobinStamer
Created May 20, 2011 20:51
Show Gist options
  • Select an option

  • Save RobinStamer/983768 to your computer and use it in GitHub Desktop.

Select an option

Save RobinStamer/983768 to your computer and use it in GitHub Desktop.
genoce:PRIMARY> db.tmp.save({_id:1, session: 100, events: [{eventID: 1}]})
genoce:PRIMARY> db.tmp.find()
{ "_id" : 1, "session" : 100, "events" : [ { "eventID" : 1 } ] }
genoce:PRIMARY> db.tmp.update({_id:1}, {$set: {"events.0.date": "2011-01-01", "events.0.title": "abc"}})
genoce:PRIMARY> db.tmp.find()
{ "_id" : 1, "events" : [ { "date" : "2011-01-01", "eventID" : 1, "title" : "abc" } ], "session" : 100 }
genoce:PRIMARY>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment