Use mongoexport/mongoimport to dump/restore a collection:
Export JSON File:
mongoexport --db --collection --out filename.json
Import JSON File:
mongoimport --db --collection --file filename.json
Import JSON File with array of objects: mongoimport --db --collection --file filename.json --jsonArray
Mongo Connection Errors
Step 1: Remove lock file. sudo rm /var/lib/mongodb/mongod.lock
Step 2: Repair mongodb. sudo mongod --repair
Step 3: start mongodb. sudo start mongodb or sudo service mongodb start
Step 4: Check status of mongodb.
sudo status mongodb
or
sudo service mongodb status
Step 5: Start mongo console. mongo
View Logs In Production sudo journalctl -u flagship-server.service
Mongo delete from collection
db.collection.find({})
db.articles.find({})
db.collection.deleteMany({})
db.articles.deleteMany({})
Managing s3 buckets https://qiita.com/alokrawat050/items/56820afdb6968deec6a2