Limit the Number of Returned Documents限制退回文件的数量
If the query bar has the Limit option, you can specify the maximum number of documents to return.如果查询栏中有“限制”选项,则可以指定要返回的最大文档数。
Set Documents to Return设置要返回的文档
To specify the limit:要指定限制:
In the Query Bar, click Options.在查询栏中,单击“选项”。Enter an integer representing the number of documents to return into the Limit field.在“限制”字段中输入一个整数,表示要返回的文档数。Click Find to run the query and view the updated results.单击“查找”运行查询并查看更新的结果。
Clear the Query清除查询
To clear the query bar and the results of the query, click Reset.要清除查询栏和查询结果,请单击“重置”。
To Learn More了解更多信息
See the 请参阅MongoDB手册中的limit
entry in the MongoDB Manual.limit
条目。
How Does the Compass Query Compare to MongoDB and SQL Queries?Compass查询与MongoDB和SQL查询相比如何?
$skip
corresponds to the 对应于SQL LIMIT ...
clause in a SQL SELECT
statement.SELECT
语句中的LIMIT ...
子句。
Example
You have 3,235 articles. You would like to see a list of the first 10 articles.你有3235篇文章。您希望看到前10篇文章的列表。
- SQL
-
SELECT * FROM article
LIMIT 10; MongoDB AggregationMongoDB聚合-
db.article.aggregate(
{ $limit : 10 }
); Compass Limit OptionCompass限制选项-
$limit : 10