db.people.update({"_id" : ObjectId("4b2b9f67a1f631733d917a7c")}, joe)
db.users.update({"name" : "joe"}, {"$set" : {"favorite book" : ["Cat's Cradle", "Foundation Trilogy", "Ender's Game"]}})
db.blog.posts.update({"author.name" : "joe"}, {"$set" : {"author.name" : "joe schmoe"}})
db.users.update({"name" : "joe"}, {"$unset" : {"favorite book" : 1}})
db.blog.update({"post" : post_id}, {"$inc" : {"comments.0.votes" : 1}})
db.blog.update({"comments.author" : "John"}, {"$set" : {"comments.$.author" : "Jim"}})
db.coll.update(criteria, {"foo" : "bar"})
db.users.update({"_id" : ObjectId("4b2d75476cc613d5ee930164")},
{"$addToSet" : {"emails" : {"$each" : ["joe@php.net", "joe@example.com", "joe@python.org"]}}})
db.movies.find({"genre" : "horror"},
{"$push" : {"top10" : {
"$each" : [{"name" : "Nightmare on Elm Street", "rating" : 6.6}, {"name" : "Saw", "rating" : 4.3}],
"$slice" : -10,
"$sort" : {"rating" : -1}}}})
{"$pop": {"key": 1}}
{"$pop": {"key": -1}}
db.lists.update({}, {"$pull" : {"todo" : "laundry"}})
db.blog.update({"post" : post_id}, {"$inc" : {"comments.0.votes" : 1}})
db.blog.update({"comments.author" : "John"}, {"$set" : {"comments.$.author" : "Jim"}})
db.analytics.update({"url" : "/blog"}, {"$inc" : {"pageviews" : 1}}, true)
db.users.update({}, {"$setOnInsert" : {"createdAt" : new Date()}}, true)
db.foo.save(x)
db.foo.update({"_id": x._id}, x)
db.count.update({x : 1}, {$inc : {x : 1}}, false, true)
db.runCommand({getLastError : 1})
{
"err" : null,
"updatedExisting" : true,
"n" : 5,
"ok" : true
}