mongoexport E QUERY SyntaxError: Unexpected identifier
今天对mongodb数据库进行操作,要导入数据库中数据,因此使用mongoimport命令。
而需要指定字段类型,因此使用
| mongoimport --db=users --collection=contacts --type=csv \ |
| --columnsHaveTypes \ |
| --fields="name.string(),birthdate.date(2006-01-02),contacted.boolean(),followerCount.int32(),thumbnail.binary(base64)" \ |
| --file=/example/file.csv |
这个就别乱找了,直接去官网看。
mongoimport — MongoDB Database Tools

因为使用mongoimport一直报错。
我想可能是语句不对,反复检查了不下十遍,可惜还是不行。

看见标黄的了吗,这就是问题所在。
不要在mongo.exe执行此命令。
而应该在外界的cmd下执行。
参考自
mongodb - mongoexport E QUERY SyntaxError: Unexpected identifier - Stack Overflow

浙公网安备 33010602011771号