I have mongo db dump which has
.bson
and
.json
files. How can i import this database in monodb through command line?
I have mongo db dump which has
.bson
and
.json
files. How can i import this database in monodb through command line?
Import a .bson file:
mongorestore -d db_name -c collection_name path/file.bson
For Json try this
mongoimport --db dbName --collection collectionName <fileName.json>
Use mongorestore to dump bson files, and use mongoimport to import json files.
Example:
Mongo Restore (without Authentication)
mongorestore dump-2013-10-25/
Mongo Restore (with Authentication)
mongorestore --host mongodb1.example.net --port 3017 --username user --password pass /opt/backup/mongodump-2013-10-24
MongoImport (without Authentication)
mongoimport --db users --collection contacts --file contacts.json
MongoImport (with Authentication)
mongoimport --host mongodb1.example.net --port 37017 --username user --password pass --collection contacts --db marketing --file /opt/backups/mdb1-examplenet.json
Refer: Link