如何将MongoDB的collection导出成CVS
伊谢尔伦
伊谢尔伦 2017-04-21 11:16:33
0
2
538

我想将MongoDB的collection导出成CVS,在官网文档写可以用mongoexport导出

mongoexport --host localhost --db dbname --collection name --csv > output.csv

但他总警告我指定要导出的字段并无法导出,我要导出所有字段啊,就跟mysql导出cvs那样,怎样忽略他的警告呢?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
Peter_Zhu

You must add an option to specify the fields you want to export. Mongodb will not select all fields for you by default, so you should add --fields <field1[,field2]>, -f <field1[,field2]&gt ;…

刘奇
mongoexport -h localhost -d dbname -c collname -f field1,field2 --csv -o output.csv
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!