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

MongoDB-mongorestore未捕获的异常:语法错误

(MongoDB - mongorestore uncaught exception: syntax error)

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

我已经转储了一些数据库,mongodump这意味着我目前有一个文件夹(名称,是我转储数据库的日期),每个数据库都有一个文件夹,并且在每个数据库文件夹中我每个集合都有2个文件,一个。 bson和一个.metadata.json。

现在,我想使用mongorestore以下命令来重建数据库及其集合:

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

但它不起作用,并退出并显示以下错误:

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

所以问题是我想mongorestore从mongo shell运行,而我应该从windows \ linux命令提示符\ terminal运行它。