mongodb collection to json code example
Example 1: mongodb export entire database
// EXPORT
mongodump -d -o
// IMPORT
mongorestore -d
Example 2: how to export mongodb database to json
sudo mongoexport --db newdb -c restaurants --out newdbexport.json