Posted By

saturngod on 03/07/11


Tagged

mongodb


Versions (?)

Paging in Mongodb


 / Published in: JavaScript
 

  1. function printStudents(pageNumber, nPerPage) {
  2. print("Page: " + pageNumber);
  3. db.students.find().skip((pageNumber-1)*nPerPage).limit(nPerPage).forEach( function(student) { print(student.name + "<p>"); } );
  4. }

Report this snippet  

You need to login to post a comment.