????> db.users.find({"favorites.artist": "Picasso"}??
????... {finished:0??points:0??badges:0}).pretty()
????//???favorites.artist??Pisanello?????
????> db.users.find({"favorites.artist": "Pisanello"}??
????... {finished:0??points:0??badges:0}).pretty()
????{
????"_id" : 1??
????"name" : "sue"??
????"age" : 19??   //Author : Leshami
????"type" : 3??   //Blog   : http://blog.csdn.net/leshami
????"status" : "P"??
????"favorites" : {
????"artist" : "Pisanello"??
????"food" : "pie"
????}??
????"lastModified" : ISODate("2016-09-30T08:00:47.826Z")
????}
????{
????"_id" : 6??
????"name" : "abc"??
????"age" : 43??
????"type" : 3??
????"status" : "A"??
????"favorites" : {
????"food" : "pizza"??
????"artist" : "Pisanello"
????}??
????"lastModified" : ISODate("2016-09-30T08:00:47.826Z")
????}
????3??db.collection.update()
????//???????db.collection.update()???????
????> db.users.update(
????...    { "favorites.artist": "Pisanello" }??
????...    {
????...      $set: { "favorites.food": "pizza"?? type: 0??  }??
????...      $currentDate: { lastModified: true }
????...    }
????... )              //??????????????У?nMatched?????????nModified?1?????????????????????
????WriteResult({ "nMatched" : 1?? "nUpserted" : 0?? "nModified" : 1 })  //?????updateOne????
????> db.users.update(
????...    { "favorites.artist": "Pisanello" }??
????...    {
????...      $set: { "favorites.food": "pizza"?? type: 0??  }??
????...      $currentDate: { lastModified: true }
????...    }??
????...    { multi: true }         //??ò???multi??????true
????... )                          //???????????????????????2?????????????????????????????
????WriteResult({ "nMatched" : 2?? "nUpserted" : 0?? "nModified" : 2 })  //?????updateMany????
????//?????????????
????> db.users.find({"favorites.artist": "Pisanello"}??
????... {finished:0??points:0??badges:0}).pretty()
????{
????"_id" : 1??
????"name" : "sue"??
????"age" : 19??
????"type" : 0??
????"status" : "P"??
????"favorites" : {
????"artist" : "Pisanello"??
????"food" : "pizza"
????}??
????"lastModified" : ISODate("2016-09-30T09:31:10.524Z")
????}
????{
????"_id" : 6??
????"name" : "abc"??
????"age" : 43??
????"type" : 0??
????"status" : "A"??
????"favorites" : {
????"food" : "pizza"??
????"artist" : "Pisanello"
????}??
????"lastModified" : ISODate("2016-09-30T09:31:10.524Z")
????}
????4??db.collection.replaceOne()
????//?滻??????????(name:"abc")
????> db.users.find({name:"abc"}??{finished:0??points:0??badges:0}).pretty()
????{
????"_id" : 6??          
????"name" : "abc"??
????"age" : 43??
????"type" : 1??
????"status" : "A"??
????"favorites" : {
????"food" : "pizza"??
????"artist" : "Picasso"
????}
????}
????//???????db.collection.replaceOne()?滻??????abc??????????滻?????????
????> db.users.replaceOne(
????...    { name: "abc" }??
????...    { name: "amy"?? age: 34?? type: 2?? status: "P"?? favorites: { "artist": "Dali"?? food: "donuts" } }
????... )
????{ "acknowledged" : true?? "matchedCount" : 1?? "modifiedCount" : 1 }  //????????????????????????
????//????滻?????
????> db.users.find({name:"amy"}??{finished:0??points:0??badges:0}).pretty()
????{
????"_id" : 6??
????"name" : "amy"??
????"age" : 34??
????"type" : 2??
????"status" : "P"??
????"favorites" : {
????"artist" : "Dali"??
????"food" : "donuts"
????}
????}
????//???db.collection.update???????????????Ч??
????> db.users.update(
????...    { name: "xyz" }??
????...    { name: "mee"?? age: 25?? type: 1?? status: "A"?? favorites: { "artist": "Matisse"?? food: "mango" } }
????... )
????WriteResult({ "nMatched" : 1?? "nUpserted" : 0?? "nModified" : 1 })
????????С??
????1??mongoDB????????к??????????????????update?????3.2?汾????updateOne??updateMany
????2??mongoDB????滻??к??????????????????update?????3.2?汾????replaceOnye??replaceMany
????3??updateOne??updateMany???update???????????update???????????multi??true??false???????updateMany???updateOne
????4??replaceOne??replaceMany????update???????????update???????????multi??true??false???????replaceMany???replaceOne