![](/style/images/good.png)
![](/style/images/bad.png)
Mongodb's & ldquo; mongodump & rdquo; command, runtime error javascript
source link: https://www.codesd.com/item/mongodb-s-mongodump-command-runtime-error-javascript.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Mongodb's & ldquo; mongodump & rdquo; command, runtime error javascript
Perhaps I have a complete misunderstanding of how mongodump
is supposed to work, but I can't seem to get it to do anything besides returning a JavaScript execution failed: SyntaxError: Unexpected identifier
error.
Here's what I'm doing:
- Mongod is running
- I want to backup a database called "mydb"
- I'm inside the mongo shell
- I tried the command
mongodump --db mydb
and get the above error - I've tried both
mongodump
andmongoexport
, both have the same issue
What am I doing wrong here?
Try the following it will work
i.Open the terminal
ii. Enter mongodump --collection collectionname --db dbname (Don't go inside mongo shell);
iii.If default port is different(other than 27017) then go for the following command
mongodump --host mongodb1.example.net --port 37017 --username user --password pass --out /opt/backup/mongodump-2011-10-24
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK