db.foo.find().limit(300)
won’t do it… it still prints out 20
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():
DBQuery.shellBatchSize = 300
will do.
MongoDB Docs – Getting Started with the mongo Shell – Executing Queries
You can use it inside of the shell to iterate over the next 20 results. Just type it if you see “has more” and you will see the next 20 items.
from the shell if you want to show all results you could do db.collection.find().toArray() to get all results without it
Could always do:
db.foo.find().forEach(function(f){print(tojson(f, ”, true));});
To get that compact view.
Also, I find it very useful to limit the fields returned by the find so:
db.foo.find({},{name:1}).forEach(function(f){print(tojson(f, ”, true));});
which would return only the _id and name field from foo.