Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

111. Working on Mongo Shell

5.1K views on YouTube

Week 3: Day 2
Section 12: Intro to Node, Mongo, & REST APIs
Tutorial 111: Working On Mongo Shell

In this video tutorial, we are going to learn about working on Mongo Shell.MongoDB is a document-oriented database program. It uses JSON like documents. You can store your data without worrying about the data structure. Mongo shell is an interactive javascript interface of MongoDB. It can be used to query and update data.

LECTURE CONTENT
00:00:00 Introduction
00:03:24 Opening MongoShell
00:05:29 Creating database
00:06:26 Adding data to the database
00:08:46 Finding the data that is added to the database
00:12:05 End

Some of the commands used in the video are as follows:
To see all the databases in your system
Command: show dbs
Example: show dbs
Result: Local 0.78125GB
Test 0.23012GB
It will show all the databases present in your system.
To check your currently used database
Command: db
It will display the name of the currently used database.
To create a new database
Command: use DATABASE_NAME
Example: To create a database with the name Xyz
Syntax: use Xyz
Your created database is not present in the list when you enter: show dbs. To display the newly created database, you need to insert at least one document into it.
Command: db.collection_name.insert({ “description1″:name1,”description2”:name2})
Example:
dbs.products. insert({“product name”:car,”price”:10,20,000})
To select documents in a collection
Command:
db.collection.find()
Example: db.products.find({“product name”:car,”price”:10,20,000})
To format the printed result,you can add .pretty() to the operation Command:
db.collection.find().pretty()

Some of the important terms to learn while using MongoDB:
Server- A server is a computer that provides data to other computers. It is connected to other devices through LAN or WAN. There are different types of servers and each type runs specific software according to the purpose of the server.
Terminal- It is an electronic or electromechanical hardware device that can be used for entering data into and transcribing data from a computer and computing device.
App.use- it is a way to register middleware or chain of middlewares before executing any end route logic or intermediary route logic depending upon the order of the middleware registration sequence.
Express/express.js- it is a back end web application framework for node.js. It is free and open-source software. It is designed to build web applications and APIs.
Npm- It is the package manager for the Node Javascript platform. It is used to publish, discover, install, and develop node programs.
JSON- Javascript Object Notation is an open standard file format and data interchange format. It is commonly used for transmitting data in web applications.
Body parser- It allows express to read the body and then parse that into a JSON object that we can understand.

Full Stack Web Development in Just 3 weeks
Published by WB Web, Under free promotions,
Watch All the videos for free for a limited time.
You can buy the course from Udemy for lifetime access.

Udemy Course Link:
https://www.udemy.com/ultimate-web/

Content Credit: Mark Price
https://www.devslopes.com/

Hosted By
WB Web Development Solutions