Reputation: 2731
I have mongodb
running in remote ubuntu server
say IP:192.168.2.10 and Port:27017
. I access mongodb
through mongoose
and node.js
. Now I want to import data from .csv
to mongodb
. I know about mongoImport
but I have no idea how to use it from windows
and where to start in windows
. I have installed node.js and mongoose using npm in my windows system. I read about mongoImport
says it should run from command prompt. In windows cmd prompt when I run
mongoimport --host 192.168.2.10 --port 27017 --collection Attributes --db Master --file <P:\Attributes.csv
I get this error.
ReferenceError: mongoimport is not defined
Should I install mongodb in windows, I don't think so. What should I do?
Upvotes: 1
Views: 4476
Reputation: 129
The primary mistake people do is try to import the csv file by issuing the mongoimport command while they are inside mongo Shell. The correct way of doing it is outside mongo shell. And ensure that you have the binary that you are trying to execute. In this case it is "mongoimport".
Upvotes: 4
Reputation: 2354
Yes you will have to get mongodb executable in windows.
After getting that, go to the bin directory in your mongodb installation and you will find the mongoimport.exe there.
Execute your command from there.
Upvotes: 3