[MongoDB] Display all records with find().forEach(printjson) or .toArray()

Tadashi Shigeoka ·  Sat, January 5, 2013

In MongoDB shell, when using db.collection.find() with a large amount of data, it displays “has more” and doesn’t show all records.

MongoDB | モンゴディービー

To display all records, add .forEach(printjson) as shown below.

db.collection.find().forEach(printjson)

Alternatively, there’s an approach using the .toArray() method.

db.collection.find().toArray()

It’s simple.

That’s all from the Gemba.