How to export MongoDB’s collection to CVS

  mongodb, question

I want to export MongoDB’s collection to CVS, which can be used in the official website documentation.mongoexportExport

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

However, he always warned me that the fields specified for export cannot be exported. I want to export all fields, just like mysql exporting cvs, how can I ignore his warnings?

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