[DOCS-1218] mongoimport --fields definition is wrong Created: 10/Mar/13  Updated: 04/Mar/15  Resolved: 12/Mar/13

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: v1.2
Fix Version/s: mongodb-2.4

Type: Bug Priority: Major - P3
Reporter: Daniel Pasette (Inactive) Assignee: Sam Kleinman (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 10 years, 49 weeks, 1 day ago

 Description   

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 



 Comments   
Comment by auto [ 12/Mar/13 ]

Author:

{u'date': u'2013-03-11T14:13:51Z', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-1218: fixing mongoimport fields documentation
Branch: master
https://github.com/mongodb/docs/commit/56ae6b3d33d5194e6e78f3c87ce6294e83780483

Comment by auto [ 12/Mar/13 ]

Author:

{u'date': u'2013-03-11T14:13:51Z', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-1218: fixing mongoimport fields documentation
Branch: v2.2
https://github.com/mongodb/docs/commit/bc97490a7a9c81250f13320000860e6706badf27

Generated at Thu Feb 08 07:40:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.