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:
mongodump --db mydb
and get the above errormongodump
and mongoexport
, both have the same issueWhat 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