I'm able to use mongoimport
to import csv data into a non-meteor mongodb database, but I can't figure out how to import a csv into my meteor app database.
I learned how to run the mongo shell for my meteor app (meteor mongo
) but I can't run mongoimport
from the shell.
The mongodb docs for mongoimport
says
In this example, mongoimport imports the csv formatted data in the /opt/backups/contacts.csv into the collection contacts in the users database on the MongoDB instance running on the localhost port numbered 27017.
mongoimport --db users --collection contacts --type csv --file /opt/backups/contacts.csv
But when I run mongod
, start my meteor app, and run mongoimport
it imports to my test
database, not my app database.
I read this stackoverflow post comment:
Use mongoexport to dump your collections individually, then mongoimport to import the files into the db named meteor in the meteor mongodb instance. The meteor mongo instance runs on port 3002 with bind_address 127.0.0.1, and the data files are in the meteor project subdirectory .meteor/local/db
But I don't understand how to connect to that instance or how to target it with the mongoimport
command.