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.
1. db.bios.find()。sort({name:1}).limit(5) 2. db.bios.find()。limit(5).sort({name:1})
1.これら2つは等しいです。最初にソートが行われ、次に結果が制限されます。2.これを最適化するために、これが頻繁なクエリになる場合は、nameに インデックスを付けることを検討してください。 3. find() の自然な順序は、一般に挿入順序ですが、ドキュメントが作成後に更新されたかどうかは保証されません。