Warm tip: This article is reproduced from serverfault.com, please click

mongorestore uncaught exception: syntax error

发布于 2020-11-28 09:34:35

I've dumped some databases using mongodump which means that I currently have a folder(which name, is the date I dumped the databases) and one folder for each database that I had and inside each database folder I have 2 files per collection, one .bson and one .metadata.json.

Now I want to use mongorestore to rebuild databases and their collections using the following command:

 mongorestore --db user --verbose /home/nvsh120/projects/database/11-26-20/user

but it doesn't work and exits with the following error:

uncaught exception: SyntaxError: unexpected token: identifier :
@(shell):1:15
Questioner
ma_jafari
Viewed
0
ma_jafari 2020-11-29 12:40:28

So the problem was that I was trying to run mongorestore from mongo shell whereas I should've run it from windows\linux command prompt\terminal.