MongoDB Database Installation

  • 24-03-2022
  • 1226
  • Mongo DB
  • Haresh Chauhan

MongoDB is the database management system. This is one kind of cross-platform document-oriented database program. This is a NoSQL database program. MongoDB uses the only JSON object documents with a schema. MongoDB is an open-source document database and a leading NoSQL database. MongoDB developed by MongoDB inc.

This tutorial will give you a great understanding of MongoDB concepts needed to create and deploy a highly scalable and performance-oriented database.

MongoDB Database Installtion

Here we need to download and install MongoDB.

Step 1 : Donwload MongoDB steup

Download MongoDB

download mongodb setup

Download the version I told you in the screenshot above. Because this version best for configure to a programming language.

Download and install it.

Step 2 : Set global environment path

Now, Open your system C:\Program Files\MongoDB\Server\4.0\bin directory and copy this URL.

Now, We move on to my computer and write click on this. Select last properties option.

In this system pop up, you can see the left sideAdvanced system settingsoption click on that and follow snapshot.

Advanced system settings

Advanced system settings

Environment variables

Environment variables

Edit variables

Edit variables

Here Paste this pathC:\Program Files\MongoDB\Server\4.0\bin and save.

Step 3 : Open Your terminal

Now in this step let us know to check MongoDB working or not.

Open your terminal and follow the command.

mongod

mongod command is use to the start of the MongoDB server.

You can see MongoDB version information when MongoDB started.

Now we move on the MongoDB database using mongo command.

mongo

Terminal

MongoDB terminal

This following command through you can manage MongoDB database.

This command through show database.

show dbs

Show all collections in the current database.

show collections

Show all users on the current database

show users

Choose Database to Work With.

use databaseName

You can show collection.

show collections;
db.getCollectionNames();

Create a Collection.

db.createCollection("collectionName");

Insert a Document in a Collection.

db.<collectionName>.insert({field1: "value", field2: "value"})

Display Collection Records.

db.<collectionName>.find();
db.<collectionName>.find({"_id": ObjectId("someid")});

I hope it can help you.

Thanks...


We always thanks to you for reading our blogs.


dharmesh-image

Dharmesh Chauhan

(Swapinfoway Founder)

Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us

haresh-image

Haresh Chauhan

(Co-Founder)


We Are Also Recommending You :