db.foo.find().limit(300)
won\'t do it. It still prints out only 20 documents.
db.foo.find().toArray()
db.foo.find().forEach(printjs
In the mongo shell, if the returned cursor is not assigned to a variable using the var keyword, the cursor is automatically iterated to access up to the first 20 documents that match the query. You can set the DBQuery.shellBatchSize variable to change the number of automatically iterated documents.
Reference - https://docs.mongodb.com/v3.2/reference/method/db.collection.find/