search

Home  >  Q&A  >  body text

mongoDB怎么把数据导出为csv或excel?

mongoDB怎么把数据导出为csv或excel?
用的可视化工具是robomongo,不知道有没有这功能。
用命令行也行。

为情所困为情所困2757 days ago766

reply all(4)I'll reply

  • 黄舟

    黄舟2017-05-02 09:22:28

    What you said above is correct, but if your data is indeed flat, you can also use mongoexport to directly export it to csv format:

    mongoexport -h [IP]:[port] -d [db] -c [collection] -u [user] -p [password] --type=csv -f [field1[,field2,field3,...]] > [filename.csv]
    For more syntax of

    mongoexport please refer to the documentation

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-02 09:22:28

    MongoDb itself is non-relational. Currently, mainstream MongoDb operating software does not and does not need to support the function of exporting to a relational table.
    To export to csv or excel, you can only write a program yourself.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-02 09:22:28

    The command line can be or mongochef~the best one

    reply
    0
  • 高洛峰

    高洛峰2017-05-02 09:22:28

    mongoexport is very easy to use! Always use mongoexport

    reply
    0
  • Cancelreply