Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Web Technology by (47.6k points)

I want to load data/restore dump data in mongoDB using mongorestore. I am trying to command

mongorestore dump

but it giving me an 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.

2 Answers

0 votes
by (106k points)

You can use the mongodump: To dump all the records:

mongodump -db databasename

0 votes
by (107k points)

You can take a dump to your local machine using the following syntax:

mongodump -h <host>:<port> -u <username> -p <password> -d ubertower-new -o /path/to/destination/directory

And for restoring from the local machine to your Mongo DB using the following command:

mongorestore -h <host>:<port> -u <username> -p <password> -d <DBNAME> /path/to/destination/directory/<DBNAME>

Related questions

0 votes
0 answers
0 votes
3 answers
0 votes
1 answer
asked Oct 18, 2019 in Web Technology by Sammy (47.6k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...