How to Install MongoDB 3.2 on Windows

Connect with

How to Install MongoDB on Windows
How to Install MongoDB on Windows OS is very easy by following these powerful steps. Before installation you can choose the windows version or platform and whether it is for testing or production environment. For testing, you can install 32 bit or 64 bit but for production must choose 64 bit. For installation, follow the following steps.

1. Choose MongoDB build and OS version

To find which version of Windows you are running, enter the following commands in the Command Prompt. It’s very much important, whether you choose 32 bit or 64 bit of build, for which one OS version. .

wmic os get caption
wmic os get osarchitecture

2. Download MongoDB

click on mongoDB download page , Once download completed, double click on .msi file to start installation.

3. Set up the MongoDB environment

Create this folder using the following commands from a Command Prompt

mkdir \data\db

You can specify an alternate path for data files using the –dbpath option to mongod.exe, for example:

C:\mongodb\bin\mongod.exe --dbpath d:\test\mongodb\data

4. Start MongoDB process

To start MongoDB, run mongod.exe. For example, from the Command Prompt

C:\mongodb\bin\mongod.exe

5. Connect to MongoDB

To connect to MongoDB through the mongo.exe shell, open another Command Prompt

C:\mongodb\bin\mongo.exe

6. Create directories (optional)

Create directories for your database and log files

mkdir c:\data\db
mkdir c:\data\log

7. Create a configuration file (optional)

create a file at C:\mongodb\mongod.cfg that specifies both systemLog.path and storage.dbPath:

systemLog:
    destination: file
    path: c:\data\log\mongod.log
storage:
    dbPath: c:\data\db

8. Install the MongoDB service (optional)

Install the MongoDB service by starting mongod.exe with the –install option and the -config option to specify the previously created configuration file

"C:\mongodb\bin\mongod.exe" --config "C:\mongodb\mongod.cfg" --install
or 
sc.exe create MongoDB binPath= "C:\mongodb\bin\mongod.exe --service --config=\"C:\mongodb\mongod.cfg\"" DisplayName= "MongoDB" start= "auto"

9. Start MongoDB (optional)

You can Start the mongod Service by issuing following command:

net start MongoDB

10. Stop MongoDB (optional)

You can stop the mongod process by issuing following command:

net stop MongoDB (optional)

11. References

  1. MongoDB Official Site

Connect with

Leave a Comment

Your email address will not be published. Required fields are marked *