更新时间:2022-03-19 04:35:14
.limit()
示例:
db.things.find().limit(10)
文档: http://www.mongodb.org/display /DOCS/Advanced + Queries#AdvancedQueries-%7B%7Blimit%28%29%7D%7D
按照下面的评论,从技术上讲,您也希望对集合进行排序,所以它将是:
As per the comment below, technically, you'd want to sort the collection too, so it would be:
db.things.find().sort({someField:1}).limit(10)