• Save
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Visit
    http://www.zariga.com
    http://www.youtube.com/user/zarigatongy
    Are you sure you want to
    Your message goes here
    Be the first to like this
No Downloads

Views

Total Views
213
On Slideshare
213
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
1
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. MongoDB PAGINATIONPAGINATION detailed
  • 2. PAGINATIONUsing limit() & skip()Reference :MongoDB(http://docs.mongodb.org/manual/reference/method/cursor.skip/)function printStudents(pageNumber, nPerPage) {print("Page: " + pageNumber);db.students.find().skip((pageNumber-1)*nPerPage).limit(nPerPage).forEach(function(student) { print(student.name + "<p>"); } ); }CONS : cursor.skip() will become slower andmore CPU intensive. With larger collections,cursor.skip() may become IO bound.
  • 3. PAGINATIONWith QueryArrange in ascending or descending orderanish 31manisha 29…………Paul 26……..………………….arjun 8>var pageCursor = db.user.find().sort({"age":-1}).limit(10000)Step 2 : iterate over the cursorwhile (pageCursor.hasNext()) {paul = 26}Start with paul age and form the next query andsort it again
  • 4. More Advanced querieshttp://docs.mongodb.org/manual/reference/operators/#AdvancedQueries-
  • 5. Thanks for Watchingfeedbackappreciated…………………………