How to get mongo command results in to a flat file

后端 未结 8 2077
攒了一身酷
攒了一身酷 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:21

    Use this

    mongo db_name --username user --password password < query1.js >> result.txt
    

提交回复
热议问题