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.
db.collectionname.find()
I tried
Use this
mongo db_name --username user --password password < query1.js >> result.txt