Sample code
1. Initial data
> Db.snapshot_test.Find(){ "_id": ObjectId ("560ba37c694895b2de42254d"),"name":"Lxy" }{ "_id": ObjectId ("560ba381694895b2de42254e"),"name":"Zyh" }{ "_id": ObjectId ("560ba38a694895b2de422550"),"name":"ZJJ" }{ "_id": ObjectId ("560feb75f31b120ca7308011"),"name":"Yhl"}
2. Add an age field to the NAME=ZJJ line to increase the space occupied by the row
> db.snapshot_test.update ({name:"zjj"},{$set: {name:"zjj ", Age:Ten}})
3. Return to query
> Db.snapshot_test.Find(){ "_id": ObjectId ("560ba37c694895b2de42254d"),"name":"Lxy" }{ "_id": ObjectId ("560ba381694895b2de42254e"),"name":"Zyh" }{ "_id": ObjectId ("560feb75f31b120ca7308011"),"name":"Yhl" }{ "_id": ObjectId ("560ba38a694895b2de422550"),"name":"ZJJ"," Age":Ten}
Because the third row occupies more space, MONGDB will re-allocate the memory space to the third record and add it to the end of the collection
4. Snapshot Query Results
> Db.snapshot_test.Find(). Snapshot () {"_id": ObjectId ("560ba37c694895b2de42254d"),"name":"Lxy" }{ "_id": ObjectId ("560ba381694895b2de42254e"),"name":"Zyh" }{ "_id": ObjectId ("560ba38a694895b2de422550"),"name":"ZJJ"," Age":Ten }{ "_id": ObjectId ("560feb75f31b120ca7308011"),"name":"Yhl"}
As you can see from the returned results, the order of the third row is changed back and the position before the space size is modified
MongoDB cursor Snapshot