java - How to fetch data dynamically from web server? -
I have a Mongodb database that has a pole collection. There are several pole documents in the pole collection, it can be a large number of documents.
I am using Java servlet to serve HTTP requests.
How can I apply the feed type retrieval system on behalf of the server? For example, in the first request, I want to retrieve 1 to 10 documents, then from 11 to 20 and so on ... as if there is a scroll in the view, I want to get data from the server and send it to the client Want to
Does the monogram provide a way to do this?
I think what you want is a paging, using the range with your search query Can and leave
First request db.Poll.find (). Skip (0) .limit (10) second request db.Poll.find () .op (10) .Milit (10) ... ...
Note: With your search should be sorted.
Db.Poll.find (). Skip to top (10) .limit (10) .sort ({_ id: -1})
For more information on cursor methods you can see here:
Comments
Post a Comment