Basic Installation

These are the installation steps for MongoDB on Microsoft Windows.

  1. Start by downloading MongoDB Community Server here: https://www.mongodb.com/download-center. Select the "Community Server" tab, and then download the installation package.
  2. In Windows Explorer, locate the downloaded MongoDB .msi file, which typically is located in the default Downloads folder.
  3. Double-click the .msi file. A set of screens will appear to guide you through the installation process.

You may specify an installation directory if you choose the “Custom” installation option.


Note: these instructions assume that you have installed MongoDB to C:\Program Files\MongoDB\Server\3.6\. MongoDB is self-contained and does not have any other system dependencies. You can run MongoDB from any folder you choose. You may install MongoDB in any folder (e.g. C:\Users\LinusTorvalds\mongodb).


Setting up the Environment

MongoDB requires a data directory to store all data.

Create the folder structure

MongoDB’s default data directory path is the absolute path \data\db on the drive from which you start MongoDB. Create this folder by running the following commands in a Command Prompt:

  • cd C:\Users\<your username>\
  • mkdir mongodb
  • mkdir mongodb\data\db
  • mkdir mongodb\data\log


Create the configuration file

Create a configuration file (with a new text file) using the code below, name it mongodb.cfg and place it at C:\Users\<your username>\mongodb\.

systemLog: 
   destination: file 
   path: c:\Users\<your username>\mongodb\data\log\mongod.log 
storage: 
   dbPath: c:\Users\<your username>\mongodb\data\db


Create the Windows Service

Open the command prompt with Administrative privileges. Then execute the following script:

  • sc.exe create MongoDB binPath= "\"C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe\" --service --config=\"C:\Users\<your username>\mongodb\mongod.cfg\"" DisplayName= "MongoDB" start= "auto"


Running the Petro.ai Database

After Mongo and the Windows Service have been created, the Petro.ai Database should start immediately after a restart. To start Petro.ai for the first time, follow these steps:

  1. Click Start > Run...
  2. Type "services.msc" then press Enter.
  3. In the list, find MongoDB.
  4. On the left-hand side, press Start.