I want to get the count of all rows in a single collection into an output file. What is the correct way of doing this
Here is what I did but I am encountering an error.
mongoexport --host 10.1.0.1:27017 --db proddb --collection UserColl --query "{db.getCollection('UserColl').count()}" --type=csv --out=output.csv
Best Answer
I created a sample.js file like the sample below:
then I run this script below on cmd: