Problem Starting MongoDB Server on Windows 8? Resolved

Everyone is loving NoSQL and mainly MongoDB. I thought to start getting my hands dirty on it. So to start with, I downloaded MongoDB for Windows and installed it. So far so good.

Next I browsed to the MongoDB folder. To start the server I entered the mongo.exe command. Oops, I encountered the error that no connection could be made to the server.



Okay, so to start using mongoDB we first need to start the mongoDB server. That can be done using the command mongod. So I tried starting the mongoDB server using the mongod command. Oops again, I got the following error that clearly says that the dbpath does not exist.



So let us proceed and create a folder data\db. We are free to create this folder at any location. However later this folder location should be set in dbpath for mongoDB.



Once the data folder has been created we need to set dbpath. That can be done as follows:



It will take some time to get this command executed. You will not see an error.

The Command prompt should stopped at:



Next launch another command prompt and type the command mongo.exe as in the following:



Here you see mongoDB has been connected to the database test. To test successful installation, let us insert one record in the test database. To insert, the command is db.test.save(jsonvalue) where test is your database.



After doing this procedure mongoDB is installed successfully on your Windows Machine. I hope this article is useful. Thanks for reading.

Next Recommended Readings