无法使用Mongo导出查询 [英] Unable to Use Mongo Export Query

查看:59
本文介绍了无法使用Mongo导出查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mongo DB中有一个名为" sample "的收集器和一个名为" at "的数据库.

I have a collecton named "sample" and database named "at" present in Mongo DB .

db.sample.find().pretty()
{
        "_id" : "35004",
        "city" : "ACMAR",
        "pop" : 6055,
        "state" : "AL"
}
{
        "_id" : "35005",
        "city" : "ADAMSVILLE",
        "pop" : 10616,
        "state" : "AL"
}
{
        "_id" : "35006",
        "city" : "ADGER",
        "pop" : 3205,
        "state" : "AL"
}

我尝试使用mongo导出查询,但未成功,请让我知道我在哪里做错了.

I have tried using mongo export query , but i was unsuccessful , please let me know where i am doing mistake .

我尝试使用以下方式,但始终会产生错误.

I have tried using below ways , but always produced an error .

mongoexport --host localhost --db at --collection "sample" --csv --out text.csv --fields city,state

mongoexport --csv -o /D:/test.csv -d at -c sample -f city,state,pop

我遇到以下错误,请帮助

I was getting the following error , please help

Sun Mar 10 00:25:44 SyntaxError:missing;声明前(shell):1

推荐答案

mongoexport必须从OS命令外壳而不是mongo shell运行.

mongoexport must be run from your OS command shell, not the mongo shell.

这篇关于无法使用Mongo导出查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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