I want to display first 20 records from collection on one Jframe and next 20 on another frame . I am newbie to MongoDB. please suggest a query to find first 20 and next 20 documents.
On the MongoDB shell you can do:
db.collectionName.find( { city: "London" } ).skip( 20 ).limit( 20 );
To show the results from document 21 to 40.
Please look at limit and skip: http://docs.mongodb.org/manual/core/read/#limit-the-number-of-documents-to-return
I also strongly suggest you go over a tutorial: http://docs.mongodb.org/manual/tutorial/getting-started/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With