How To Install MongoDB Step By Step Procedure, MongoDB Tutorial
Hello guys, welcome back to my blog. In this article, I will discuss how to install MongoDB step-by-step procedure, from where to install MongoDB, commands to be used, Tutorials on MongoDB, etc.
If you have any doubts related to electrical, electronics, and computer science, then ask question. You can also catch me @ Instagram – Chetan Shidling.
Also, read:
- Roadmap To Become A Big Data And Analytics Engineer.
- Data Structures And Algorithms Top Interview Questions And Answers.
- Data Analytics Life Cycle, All Stages Involved While Processing Data.
How To Install MongoDB
MongoDB is a NoSQL program. It uses JSON format. You can download MongoDB from their website Mongodb.com. MongoDB is famous among new developers due to it’s flexibility and ease of usage. Even though it’s easy to use it still offers all the capabilities required to meet the complex needs of modern applications. A lot of developers like Mongo because it stores data or all of it’s documents in JSON.
Steps To Install MongoDB
01. Go and download MongoDB software – Click Here.
02. Installing process.
Microsoft Windows [Version 10.0.19042.928]
(c) Microsoft Corporation. All rights reserved.
C:\Users\HP>cd C:\Program Files\MongoDB\Server\4.4\bin
C:\Program Files\MongoDB\Server\4.4\bin>mongo --version
MongoDB shell version v4.4.5
Build Info: {
"version": "4.4.5",
"gitVersion": "ff5cb77101b052fa02da43b8538093486cf9b3f7",
"modules": [],
"allocator": "tcmalloc",
"environment": {
"distmod": "windows",
"distarch": "x86_64",
"target_arch": "x86_64"
}
}
C:\Program Files\MongoDB\Server\4.4\bin>
Microsoft Windows [Version 10.0.19042.928]
(c) Microsoft Corporation. All rights reserved.
C:\Users\HP>mongo --version
'mongo' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\HP>
You get error, if you run in this path. Now, you need to create environment. Steps are given below.
After adding path, now run again the command.
Microsoft Windows [Version 10.0.19042.928]
(c) Microsoft Corporation. All rights reserved.
C:\Users\HP>mongo --version
MongoDB shell version v4.4.5
Build Info: {
"version": "4.4.5",
"gitVersion": "ff5cb77101b052fa02da43b8538093486cf9b3f7",
"modules": [],
"allocator": "tcmalloc",
"environment": {
"distmod": "windows",
"distarch": "x86_64",
"target_arch": "x86_64"
}
}
C:\Users\HP>
C:\Users\HP>mongo
//Type mongo and click on enter.
MongoDB shell version v4.4.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("521c7eee-b0a6-4ec2-875a-db160d3ebb88") }
MongoDB server version: 4.4.5
---
The server generated these startup warnings when booting:
2021-05-04T21:29:49.730+05:30: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
---
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
>
>show dbs
//It shows already existing database
admin 0.000GB
agentlogs 0.000GB
automationagentlog 0.000GB
Steps to create database and add items.
> use firstdatabase
switched to db firstdatabase
>
> use firstdatabase
switched to db firstdatabase
> db.students.insert({"Name":"Chetan"})
WriteResult({ "nInserted" : 1 })
>
> use firstdatabase
switched to db firstdatabase
> db.students.insert({"Name":"Chetan"})
WriteResult({ "nInserted" : 1 })
> db.students.insert({"Name":"Nitin"})
WriteResult({ "nInserted" : 1 })
>
> use firstdatabase
switched to db firstdatabase
> db.students.insert({"Name":"Chetan"})
WriteResult({ "nInserted" : 1 })
> db.students.insert({"Name":"Nitin"})
WriteResult({ "nInserted" : 1 })
> show collections;
students
>
Try some more things:
use examples
db.inventory.insertMany([
{ item: "journal", qty: 25, status: "A", size: { h: 14, w: 21, uom: "cm" }, tags: [ "blank", "red" ] },
{ item: "notebook", qty: 50, status: "A", size: { h: 8.5, w: 11, uom: "in" }, tags: [ "red", "blank" ] },
{ item: "paper", qty: 10, status: "D", size: { h: 8.5, w: 11, uom: "in" }, tags: [ "red", "blank", "plain" ] },
{ item: "planner", qty: 0, status: "D", size: { h: 22.85, w: 30, uom: "cm" }, tags: [ "blank", "red" ] },
{ item: "postcard", qty: 45, status: "A", size: { h: 10, w: 15.25, uom: "cm" }, tags: [ "blue" ] }
]);
Continue reading for some examples – Click here
I hope this article “How To Install MongoDB” may help you all a lot. Thank you for reading.
Also, read:
- 100+ C Programming Projects With Source Code, Coding Projects Ideas
- 1000+ Interview Questions On Java, Java Interview Questions, Freshers
- App Developers, Skills, Job Profiles, Scope, Companies, Salary
- Applications Of Artificial Intelligence (AI) In Renewable Energy
- Applications Of Artificial Intelligence, AI Applications, What Is AI
- Applications Of Data Structures And Algorithms In The Real World
- Array Operations In Data Structure And Algorithms Using C Programming
- Artificial Intelligence Scope, Companies, Salary, Roles, Jobs