Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Installing and Configuring MongoDB on Windows

Tech 1

Required Software Version

The installation package used in this tutorial is:

mongodb-win32-x86_64-2008plus-ssl-3.4.4-signed.msi

Alternative version available:

mongodb-win32-x86_64-2008plus-3.4.24-signed.msi

Step-by-Step Installation Proces

1. MongoDB Installation Guide

  1. Execute the instaler file mongodb-win32-x86_64-2008plus-ssl-3.4.4-signed.msi by double-clicking
  2. Proceed by clicking "Next"
  3. Accept the license agreement to continue, then click "Next"
  4. Select the custom installation option instead of typical, followed by "Next"
  5. Specify your preferred installation directory. Example path: D:\MongoDB\Server\3.4\
  6. Confirm your selected directory and proceed with "Next"
  7. Complete the installation by clicking "Install"

2. Post-Installation Configuration

  1. Navigate to your installation directory and copy the bin folder path: D:\MongoDB\Server\3.4\bin
  2. Add this path to your system's environment variables
  3. Create two directories under D:\MongoDB: data and log, plus a configuration file named mongodb.config
  4. Within the data folder, create a subdirectory called db. Inside the log folder, create a file named mongo.log
  5. Configure the mongodb.config file with these entries:
logpath=D:\MongoDB\log\mongo.log
dbpath=D:\MongoDB\data\db
  1. Launch Command Prompt as Administrator (★Administrator privileges are mandatory)
  2. Execute the following command (adjust paths according to your setup):
mongod --dbpath D:\MongoDB\data\db
  1. After the process completes, verify installation by accessing http://127.0.0.1:27017/ in your browser. A successful connection indicates MongoDB is running.

  2. Install MongoDB as a Windows service. After stopping the current instance with Ctrl+C, run one of these commands:

mongod --config D:\MongoDB\mongodb.config --install

or

mongod --dbpath "D:\MongoDB\data\db" --logpath "D:\MongoDB\log\mongo.log" --install --serviceName "MongoDB"

Ensure all paths match your actual installation directories

Verify successful service installation by pressing Windows+R and typing services.msc to open the Services panel.

If services.msc doesn't work, try right-clicking on 'This PC' from desktop, select 'Manage', then navigate to Services and Applications > Services.

Daatbase Operation Commands

Starting the MongoDB Service

  1. From an administrator Command Prompt, execute:
net start MongoDB
  1. Alternatively, start the service through the Windows Services interface
  2. Access the database by entering:
mongo

Stopping the MongoDB Service

  1. Use Command Prompt (administrator mode) to execute:
net stop MongoDB
  1. Or stop through the Windows Services panel

Standard MongoDB operations can be found in additional documentation.

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.