MongoDB is a hot technology available today that is used in various real-time applications and is in great demand these days. In this post, let’s look at the steps to setup MongoDB in Windows. This post is focused at people who have some basic knowledge about software in.
Let’s begin by understanding what MongoDB is.
What is MongoDB?
MongoDB is an open-source document database and a leading NoSQL database. MongoDB is written in C++.
Now, let’s head on to the installation of MongoDB.
Installing MongoDB on Windows
The following are the steps to install the MongoDB on windows:
Step1: Download the latest release of MongoDB
Make sure you get correct version of MongoDB depending upon your windows version. (Choose legacy)
For 64 bit, use this link to download -> https://www.mongodb.org/downloads
Step2: Extract the zip file.
Step3: Set up the MongoDB environment.
MongoDB requires a data directory to store all data. MongoDB’s default data directory path is\data\db. Create this folder using the following commands from a Command Prompt:
You can specify an alternate path for data files using the –dbpath option to mongod.exe.
C:\mongodb\bin\mongod.exe –dbpath d:\test\mongodb\data
If your path includes spaces, enclose the entire path in double quotes, like below: C:\mongodb\bin\mongod.exe –dbpath “d:\test\mongo db data”
You can also specify the dbpath in a configuration file.
Step4: Start MongoDB.
To start MongoDB, run mongod.exe. You can do this by typing the below command in the Command Prompt:
This starts the main MongoDB database process. The waiting for connections message in the console output indicates that the mongod.exe process is running successfully.
Depending on the security level of your system, Windows may pop up a Security Alert dialog box about blocking some features of C:\mongodb\bin\mongod.exe from communicating on networks. All users should select private networks, such as my home or work network and click ‘Allow access’. For additional information on security and MongoDB, please see the Security Documentation.
Step5: Connect to MongoDB.
To connect to MongoDB through the mongo.exe shell, open another Command Prompt and type the following:
If you want to develop applications using .NET, see the documentation of C# and MongoDB for more information.
Step6: Begin using MongoDB.
To help you start using MongoDB, MongoDB provides ‘Getting Started’ guides in various driver editions. Before deploying MongoDB in a production environment, consider the Production Notes document. Later on, to stop MongoDB, press Control + C in the terminal where the MongoDB instance is running.
Latest Version of MongoDB
MongoDB 3.0.8 is out and is ready for production deployment. This release contains only fixes since 3.0.7, and is a recommended upgrade for all 3.0 users.
This release candidate includes a critical fix for SERVER-21275: when using the WiredTiger storage engine, a race condition may prevent locally committed documents from being immediately visible to subsequent read operations. This bug may have an impact on both server and application operations.
All MongoDB 3.0 users running (or wishing to run with) the WiredTiger storage engine should upgrade to 3.0.8.
MongoDB works on concept of collection and document. So now you can start installing MongoDB and work on it. If you have any queries feel free to write us at [email protected]