Learn MongoDB And Its Important Queries Within Five Days -1

In this post, We will talk about MongoDB and important commands available in it. Many of you already familiar with SQL databases like Oracle, MySQL, SqlServer, or PostgreSQL. However in the recent years No SQL databases gaining its popularity in the market. Mongo DB is one of the significant and reliable No SQL databases.

List of databases based on its popularity.

In the above table, you can find top four positions occupied by well-established RDBMS Databases and In the fifth position, we have our hero MongoDB. Before we jump into MongoDB we need to understand some basic difference between SQL and No SQL Databases.

Some of the difference between SQL and NoSQL.

If your application doesn’t need Transaction, then you can very well prefer MongoDB as your application database.

MongoDB

MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling.

In MongoDB, Everything is stored as a document and all these documents are similar to JSON object. Documents are the data structures composed of key and value pairs. These values can be arrays or array of Objects. Example Document,

Key Features of MongoDB:

High Performance.

Rich Query Language.

High Availability.

Horizontally Scalable.

Support for Multiple Storage Engine.

First Install MongoDB in your machine, MongoDB installer available for all the operating system. Even without installing, you can run MongoDB Commands by utilizing Mongo Shell available in the Mongo Website where you can test run your commands.

Datatypes Available in Mongo:

In MongoDB, Tables are called as Collections. Group of documents enclosed within a Collections. Each DB can have multiple collections present in it. Now Let’s look into some basic mongo queries.

List DB

To list all the database available on the server, Show dbs command is used.

Create DB

There are no specific commands to create DB in the mongo server. However, you can use “Use dataBase Name” command to created new DB.

From the screenshot, use test command switches you to test DB even though it doesn’t exist and DB created temporarily but once you create a collection then DB will be created permanently.

Next post will be coming soon. You can follow our facebook page for latest updates.