How to use mongoimport to import csv

Trying to import a CSV with contact information:

Name,Address,City,State,ZIP  
Jane Doe,123 Main St,Whereverville,CA,90210  
John Doe,555 Broadway Ave,New York,NY,10010 

Running this doesn’t seem to add any documents to the database:

$ mongoimport -d mydb -c things --type csv --file locations.csv --headerline

Trace says imported 1 objects, but firing up the Mongo shell and running db.things.find() doesn’t show any new documents.

What am I missing?

23 Answers
23

Leave a Comment