MongoDB导入和导出到CSV [英] Mongodb importing and exporting to csv

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

问题描述

尝试从命令行(MongoDB)导入或导出时:对于Ex:

When trying to import or export from command line (MongoDB): For Ex:

> mongoimport --db denistest --collection things --type csv --file C:/Users/Administrator/Desktop/csv_data.csv

我遇到" JavaScript执行失败:SyntaxError:意外的标识符"错误吗?

这是怎么了?

推荐答案

我终于找到了问题所在.我正在mongo.exe中执行命令. (我打开C:\ mongodb \ bin> mongo并执行了我的命令)

I finally found the problem. I was executing my command in mongo.exe. ( I opened C:\mongodb\bin>mongo and the executed my command )

C:\mongodb\bin>mongo
MongoDB shell version: 2.4.0
connecting to: test
>
> mongoimport --db denistestcsv --collection things --type csv --fields First,La
st,Visits,Location,Number,Url,Letter --file E:\temp\csv1.csv

但这是错误的.正确的方法是转到mongo => bin =>然后执行命令而不输入mongo.exe

But this is wrong. The correct way is going to mongo => bin => and then executing command without entering mongo.exe

C:\mongodb\bin>mongoimport --db denistestcsv --collection things --type csv --fi
elds First,Last,Visits,Location,Number,Url,Letter --file E:\temp\csv1.csv

这篇关于MongoDB导入和导出到CSV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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