mongoexport语法错误消息 [英] mongoexport syntax error message

查看:114
本文介绍了mongoexport语法错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用mongodb 2.4.3,但无法使mongoexport正常工作.我通过每个命令得到的错误消息是: "JavaScript execution failed: SyntaxError: Unexpected identifier"

I'm working with mongodb 2.4.3 and I cannot get mongoexport to work. The error message I get with each command is: "JavaScript execution failed: SyntaxError: Unexpected identifier"

起初,我认为问题出在我的查询参数上,这很长.但是find()在查询中工作正常,所以我知道语法还可以.然后,我使用查询创建了一个新集合,并尝试使用以下命令导出该集合:

At first I thought the problem was with my query parameters, which were long. But find() worked fine with the query so I know that the syntax is ok. I then created a new collection using the query and tried exporting the collection with the following:

mongoexport --db Oct2012 --collection sept8subset --csv --fields "text","created_at","user.screen_name","user.followers_count" --out sept8.csv

mongoexport --db Oct2012 --collection sept8subset --csv --fields text,created_at,user.screen_name,user.followers_count --out sept8.csv

mongoexport -d Oct2012 -c sept8subset --csv --fields text,created_at,user.screen_name -o sept8.csv

mongoexport --db Oct2012 --collection sept8subset --dbpath ~/db (should need dbpath as mongod instance is running)

mongoexport --db OCt2012 -collection sept8subset -o sept8.txt

mongoexport --db Oct2012 --collection sept8subset

在每种情况下,我得到"JavaScript execution failed: SyntaxError: Unexpected identifier".该SyntaxError可能在哪里?

In each case, I get "JavaScript execution failed: SyntaxError: Unexpected identifier". Where could that SyntaxError be??

我要复制的集合有50,339个对象.如果mongoexport无法处理的太大,我从集合中取出了5个文档以制作一个新集合.然后,我尝试使用与上述相同的命令结构将其导出.我仍然收到相同的错误消息.

The collection I'm trying to copy has 50,339 objects. In case it is just too big for mongoexport to handle, I took 5 documents out of the collection to make a new collection. I then tried to export them using same command structure as above. I still get the same error message.

现在,我想知道问题是否在于mongoexport无法处理涉及日期的数据. MongoDB文档指出,我可能想使用客户端驱动程序编写自己的导出脚本.

Now I'm wondering if the problem is that mongoexport can't work with data involving dates. MongoDB documentation states that I may want to write my own export script using a client driver.

有人知道我的问题在这里吗?非常感谢您的帮助.

Does anyone have an idea of what my problem is here? Many thanks if you can help out.

推荐答案

我发现从mongo客户端运行mongoexport(就像我在做的那样)是不正确的. Mongoexport在命令提示符下执行.

I found out that running mongoexport from the mongo client--as I was doing--is incorrect. Mongoexport is executed at the command prompt.

这篇关于mongoexport语法错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆