Specifically, I want to print the results of a mongodb find() to a file. The JSON object is too large so I\'m unable to view the entire object with the shell wi
find()
As answer by Neodan mongoexport is quite useful with -q option for query. It also convert ObjectId to standard format of JSON "$oid". E.g:
-q
ObjectId
"$oid"
mongoexport -d yourdb -c yourcol --jsonArray --pretty -q '{"field": "filter value"}' -o output.json