What are the basics of MongoDB Scripts?
I think the script will end with .js, and we run it using mongo try.js
.js
mongo try.js
But if I put
<
There's a built-in function for printing a json object.
Just append .forEach(printjson) to the end of the function call.
.forEach(printjson)
db.foo.find().forEach(printjson);