Created
April 16, 2013 06:33
-
-
Save tairov/5393819 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var current_id; // id of first record on current page. | |
// go to page current+N | |
db.collection.find({_id: {$gt: current_id}}). | |
skip(N * page_size). | |
limit(page_size). | |
sort({_id: 1}); | |
// go to page current-N | |
db.collection.find({_id: {$lt: current_id}}). | |
skip((N-1)*page_size). | |
limit(page_size). | |
sort({_id: 1}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment