MongoDB - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

MongoDB Shell

MongoDB Shell

shape Description

MongoDB shell is known as the interactive JavaScript interface to MongoDB. The MongoDB will connect to the database by manipulating some data from the database. The main terminology in this technology is to understand the concept of NoSQL and MongoDB versus relational databases. The relational database stores the data in terms of rows and tables. The misalignment application layer objects to tables and rows is called as impedance mismatch. While performing MongoDB then we have to spend a lot of time in the MongoDB shell.The role and responsibilities of mongoDB includes ecosystem and explore some of the usage scenarios that are to be encountered.

shape Syntax

The Syntax for MongoDB shell is as follows
~/. dbshell
And also retrieve the history of the command line by click up and down arrows.

Command line options for mongo shell

shape Description

The below table display the command that are followed in MongoDB.
Command options Explanations
--help Displays the options in the command line
--nodb Begin the mongo shell beyond associating with the database.
--Shell Utilised as a part of conjunction besides the JavaScript record (i.e.) to proceed in the mongo shell subsequent to running the JavaScript record.

Roles of Shells in Ecosystem

shape Description

The application on the web server or an application on the web can directed connected to the MongoDB Server. Where some of the specific operation are to be performed such as saving and reading data directly from the application. And also these shells will detects the inner configuration of MongoDB. And these shell will detect whether the MongoDB is performing the operations as per the desire stimulation. And these mongo shell is simply an application that allows to interactively get the insight of Mongo server. The shell uses the same wire protocol as that an application contains. Mongo shells simply connects to another application that interact with the MongoDB and can easily understand the wire protocol.

Java script operations

shape Description

For database operations MongoDB uses the java script operations such as.
Java script operations Explanations
db.auth() If it is working in safety condition, validate the client.
Coll = db. Arrange a particular set in the present database to a column_name variable.
db.collection.save() Embed either an advanced record or redesign a current record in the accumulation.
db.collection.insert() Embed another advanced record inside these accumulation.
db.collection.update() Redesign a current record in the accumulation.
db.collection.remove() Remove the records from the accumulation.
db.collection.drop() Completely drop the accumulations.
db.getsiblingDB() Gives back a hint to different database utilizing similar association beyond clearly exchanging the present database. This takes into account cross database inquiries.
db.collection.createIndex() Make another list on the accumulations when the list didn't present. Generally, the functions has no impact.

Summary

shape Key Points

  • MongoDB Shell - Is an interactive javascript interface to MongoDB and it's components.
  • Command Line options for Mongo shell - Describes the command line options in the MongoDB database.
  • Roles of shells in ecosystem - Perform saving and reading data directly from the application.