I want to load data/restore dump data in mongoDB using mongorestore. I am trying to command
mongorestore dump
but it giving me error
Sat Sep 21 16:12:33.403 JavaScript execution failed: SyntaxError: Unexpected identifier
How can we restore or put data into mongoDB?? Please give me the steps.
mongodump: To dump all the records:
mongodump --db databasename
To limit the amount of data included in the database dump, you can specify --db and --collection as options to mongodump. For example:
mongodump --collection myCollection --db test
This operation creates a dump of the collection named myCollection from the database 'test' in a dump/ subdirectory of the current working directory. NOTE: mongodump overwrites output files if they exist in the backup data folder.
mongorestore: To restore all data to the original database:
1) mongorestore --verbose \path\dump
or restore to a new database:
2) mongorestore --db databasename --verbose \path\dump\<dumpfolder>
Note: Both requires mongod instances.