我想在一个Jframe上显示集合中的前20条记录,在另一帧上显示下20条记录。我是MongoDB的新手。请提出查询以查找前20个和后20个文档。
在MongoDB Shell上,您可以执行以下操作:
db.collectionName.find( { city: "London" } ).skip( 20 ).limit( 20 );
Run Code Online (Sandbox Code Playgroud)
显示文件21至40的结果。
请查看限制并跳过:http : //docs.mongodb.org/manual/core/read/#limit-the-number-of-documents-to-return
我也强烈建议您阅读一个教程:http : //docs.mongodb.org/manual/tutorial/getting-started/
| 归档时间: |
|
| 查看次数: |
6682 次 |
| 最近记录: |