Mongo Shell GIMME MORE

When retrieving documents in the mongo shell using the find() method, without assigning to a var, it will print only the first 20 documents that match the query.

After which you’ll get the infamous prompt:

Type "it" for more

to iterate 20 more documents.

It can be extremely useful to increase the default number of displayed documents.

To achieve that, all you need to do is to set DBQuery.shellBatchSize attribute:

DBQuery.shellBatchSize = 100;

and voilĂ , you now have 100 documents returned.


comments powered by Disqus