Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 mongoDB 中,仅使用其获取文档的下一个和上一个文档的最佳实践是什么_id?
_id
如果您想按创建顺序对文档进行排序,可以按文档 _id 进行排序。
IE
db.mycollection.find().sort({_id:-1});
参见: http ://www.mongodb.org/display/DOCS/Optimizing+Object+IDs#OptimizingObjectIDs-Sortbyidtosortbyinsertiontime