How do you export all the records in a MongoDB collection to a .csv
file?
mongoexport --host localhost --db dbname --collection name --type=csv
This working for me Try it
mongoexport --host cluster0-shard-dummy-link.mongodb.net:27017 --db yourdbname --forceTableScan --collection users --type json --out /var/www/html/user.json --authenticationDatabase admin --ssl --username Yourusername --password Yourpassword
Above cmd return whole data of the users collection if you want filter field then add --fields=email,name