I'm trying to import a csv into mongodb using the following command:
mongoimport --db users --collection contacts --file data.csv --headerline
The database exists but not the collection, I want to create it and use the first row of the csv as the field names. Why am I getting error:
error validating settings: must specify --fields, --fieldFile or --headerline to import this file type
I also would like to know:
- how to copy/import data from one collection into another (basically the syntax)
- how datatypes from csv are handled in mongodb when imported; do I need to specify datatypes for headers or will mongodb read it from csv types?