My requirement is to print all the data from a collection to a CSV file, but I don't know the name of all the fields.
When I am using the following format, I get the error
mongoexport -h ServerName -p PortName -c CollectionName -csv "C:\data.csv" -u UserId -p Password
ERROR: too many positional options
To use CSV, one need to specify --fields or --fieldFile...for which I need to know the name of all possible fields in a given collection.
Anybody knows how to get all the fieldnames of a collection ? Appreciate the help. Thanks.