mongodb

How to print out more than 20 items (documents) in MongoDB's shell?


db.foo.find().limit(300)

won't do it. It still prints out only 20 documents.

db.foo.find().toArray()
db.foo.find().forEach(printjson)

will both print out very expanded view of each document instead of the 1-line version for find():


Solution

  • DBQuery.shellBatchSize = 300
    

    MongoDB Docs - Configure the mongo Shell - Change the mongo Shell Batch Size