-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: v1.2
-
Component/s: manual
-
Labels:None
http://docs.mongodb.org/manual/reference/mongoimport/#cmdoption-mongoimport--fields
It is actually the names of the fields which are used when importing a csv/tsv files, just like if the first line of the data file was a header with the field names (it is for when you have no header line).
For example, if you're csv file looks like this:
ObjectID(5129532ad3f16b57ad27c1a8),1.0 ObjectID(513ceccbdde3c92b2241d259),
And you want your imported docs to look like:
{ "_id" : "ObjectID(5129532ad3f16b57ad27c1a8)", "a" : 1 } { "_id" : "ObjectID(513ceccbdde3c92b2241d259)" }
You would import like this:
mongoimport -c col -d test --type csv --fields _id,a /tmp/col.csv