1.Getting started with Mongo DB Installation

Contents

Introduction :

MongoDB is one of the major No-SQL DB, which is currently ranking high on the list here. This DB comes as an Enterprise Edition as well as Community Edition.

In this post, you will see how to install Free Community MongoDB.I will use Windows machines here. However, you can also install in other flavors of the Operating System similarly. We will also see how to create a database, and then create a collection and insert few records into the collection.

Let’s get started.

Step1: Open here and scroll down and check the Available Downloads as below. I have selected Windows Platform, Version, and Package are populated automatically.

Step2: Below shown file will be downloaded, click on the executable file mongodb-windows-x86_64-4.4.4-signed to install the software and click Next

Step2: Uncheck on Install MongoD as a service.

Step4: Click Next and finish the installation. Mongo Compass is also installed by default,If you do not want this, then uncheck it.

Step5: Create directories as below in C folder as below.This is just to route all the log displayed to these directories

Step6: To start the MongoDB server, the MongoDB command is used. Open the command prompt from the path where MongoDB is installed C:\Program Files\MongoDB\Server\4.4\bin and execute the below commands. This will start the MongoDB server.

cd C:\Program Files\MongoDB\Server\4.4\bin
mongod --dbpath c:\data\data1\ --port 27017 --logpath c:\data\log\mongo1.log

Step7 : Mongo server can be accessed by using the shell or compass. Lets see how to create a database here using shell..MongoDB client can be initiated using the command Mongo. Open the Mongo terminal as below

Step8:Run the below command to see existing DBS

show dbs;

Step9: Create a DB by using the below command, Let us create the DB as mytutorialDB

use mytutorialDB;

Step10: Let’s insert a record into a collection and check it is inserted or not.

db.col1.insertOne({name:'LearnFundas'});
db.col1.find();

Leave a Comment