Thursday, 11 January 2018

Install MongoDB 3.6 in Windows (Using .msi Installer)

Installation:


First check your OS architecture using:

wmic os get osarchitecture

          If it is 64-bit architecture, get latest 3.6 community installer from MongoDB official link

Note:From MongoDB 3.4, MongoDB no longer supports 32-bit x86 platforms.
         For MongoDB 3.6 community Edition, requires Windows Server 2008 R2, Windows 7, or later.
         
          If you install through .msi installer, it includes all other software dependencies and will automatically upgrade any older version of MongoDB installed in that machine.



      
Read License agreement and accept the license to proceed. Then press next.



 Here, we will get 2 options to choose mongo installation.

    Complete: It will install complete package in default paths.
    Custom:  We can select required features and path to install.



            If you select ‘custom’, window will be like below:


Note: Here you can select which features need to install and can specify location manually where we need to install.

 If you select ‘complete’ set up, installation will happen in default path with all available features.

           If you want compass, select ‘Install MongoDB Compass’. Press next.


Now it is ready to install mongoDB. Press on Install.




      Press on Finish to complete installation.


Start and connect to mongoDB Server:


Note: Default Installation path : c:\Program Files\MongoDB\Server\3.6\bin
          Default data Dir  path : c:\data\db.

To start mongod process, we need to create data directory to store all data. 

md c:\data\db

          Note: You can create data directory in different path also. You have to specify that path in dbpath while starting mongod process.
           
         Start mongod process by specifying above dbpath.

c:\Program Files\MongoDB\Server\3.6\bin>mongod.exe --dbpath c:\data\db

Note: If you got log message like ‘waiting for connections on port 27017’ on command prompt after mongod process start, then process is started and ready to connect to mongo server.


Now open another command prompt and connect to mongo server using:

c:\Program Files\MongoDB\Server\3.6\bin>mongo.exe

        Now you are inside DB, by default it will connect to ‘test’ DB.

     Now you can run all DB related commands.

                                                                                                                                        -- Thiru //