How to get mongo command results in to a flat file

后端 未结 8 2073
攒了一身酷
攒了一身酷 2021-01-30 06:26

How do I export the results of a MongoDB command to a flat file

For example, If I am to get db.collectionname.find() into a flat file.

I tried

8条回答
  •  孤街浪徒
    2021-01-30 07:28

    mongoexport --db db_name --collection collection_name --csv --out file_name.csv -f field1,field2, field3

提交回复
热议问题