viebel
viebel

Reputation: 20680

Inside mongodb shell how to retrieve next results?

In mongodb shell, I would like to retrieve the next elements for a query.

cursor = db.collection.find({ok: true});

Now, I see 20 results.

I would like to see the next results.

Upvotes: 4

Views: 990

Answers (2)

dlaidlaw
dlaidlaw

Reputation: 1803

You can also just skip the first set of results:

db.collection.find({ok: true}).skip(20)

This is useful whatever the shellBatchSize setting.

Upvotes: 1

AdaTheDev
AdaTheDev

Reputation: 147314

Reference: mongodb.org

After the find, just run: it

Note you can increase the batch size, e.g.

DBQuery.shellBatchSize = 100

Upvotes: 8

Related Questions