What is Database?

A database is a systematically organized storage of information, allowing easy insertion, updating, analysis, and retrieval of data.

There are several different types of databases, including relational databases, NoSQL databases, and in-memory databases.

Relational databases are based on the relational model and use SQL (Structured Query Language) to store and retrieve data. Here, data is organized into tables.

NoSQL can be defined as a technique for database design, which helps accommodate a wide range of data models, including key-value, columnar, documents, or graph data.

In this particular blog we will look into MongoDB, which is a NoSQL database. Visit MongoDB and download.

MongoDB

MongoDB is a rich open-source and one of the widely recognised NoSQL database. It is written in C++ programming language.

MongoDB is a document-oriented database

reactjs-functions

Database is a physical container for collections. Collection is a group of documents and is similar to an RDBMS table. A document is a set of key-value pairs. Documents have dynamic schema.

MongoDB supports many datatypes such as String,Integer, Array, Object, Null etc

MongoDB - Operations

We can perform CRUD opeartions on database/ collection/ document.

MongoDB is a document-oriented database

mongodb-crud-commands
Popular commands

Create database - use testDb
Remove database - testDb.dropDatabase()
Create colletion - testDb.createCollection("testCollection")
Remove collection - testDb.testCollection.drop()
Create/ Insert document - testDb.testCollection.insertOne("name": "john")
Read/ Find document - testDb.testCollection.find("name": "john")
Update document -
testDb.testCollection.update("name": "john", $set: {"name": "johnny"})
Remove document - testDb.testCollection.remove("name": "john")

Advantages of MongoDB over RDBMS

  • Schema less
  • Easy to scale
  • Deep query-ability. MongoDB supports dynamic queries on documents using a document-based query language that’s nearly as powerful as SQL.