Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect to MongoDB in Windows?

I'm trying to run Mongo from the Command-Line: What's wrong? (I've IIS on localhost:80). And Apache on port 8080. Are there any issues with this?

C:\MONGO\Project1\mongo\bin>mongo --port 27017 MongoDB shell version: 2.0.3 connecting to: 127.0.0.1:27017/test Sat Mar 10 16:16:45 Error: couldn't connect to server 127.0.0.1:27017 shell/mong o.js:86 exception: connect failed 
like image 904
marko Avatar asked Mar 10 '12 15:03

marko


People also ask

How do I access MongoDB from command prompt?

Open up your command prompt and type mongod to start the MongoDB server.


2 Answers

I found that when I got this error it wasn't because I didn't have my default db path set up. It was because I was trying to run mongo.exe before running mongod.exe.

like image 140
Don Hogan Avatar answered Sep 19 '22 21:09

Don Hogan


Did you create the default db path?
It defaults to "/data/db directory (or c:\data\db on Windows)"
Source: http://www.mongodb.org/display/DOCS/Starting+and+Stopping+Mongo

like image 25
JHN Avatar answered Sep 19 '22 21:09

JHN