What is MongoDB - MongoDB Tutorial



What is MongoDB ?

  • MongoDB is a document-oriented NoSQL database used for high volume data storage.
  • Instead of using tables and rows as in the old-style relational databases, MongoDB makes use of collections and documents.
  • Documents contain key-value pairs which are the basic unit of data in MongoDB.
  • Collections contain sets of documents and function which is the equal of relational database tables.
  • MongoDB is a database which came into mid-2000s.
  • MongoDb
  • MongoDB stores data in flexible, JSON-like documents, meaning fields can vary from document to document and data structure can be different over time.
  • Ad hoc queries, indexing, and real time aggregation provide powerful ways to access and analyse your data.
  • MongoDB is a distributed database at its core, so high availability, horizontal scaling, and geographic distribution are built in and easy to use.

MongoDB Features

MongoDb
  • Each database holds collections which in turn contains documents. Each document can be different with a changing number of fields. The content and size of each document can be different from each other.
  • The document structure is more in line with how developers construct their classes and objects in their particular programming languages. Developers will often say that their classes are not rows and columns but have a clear structure with key-value pairs.
  • The rows (or documents as called in MongoDB) doesn’t need to have a schema defined earlier. Instead, the fields can be created on the fly.
  • The data model available in MongoDB allows you to denote hierarchical relationships, to store arrays, and other more complex structures more easily.
  • Scalability – The MongoDB environments are very scalable.

Why Use MongoDB ?

  • Document-oriented
    • Since MongoDB is a NoSQL type database, instead of having data in a relational type format, it stores the data in documents. This makes MongoDB very flexible to real business world situation and requirements.
  • Ad hoc queries
    • MongoDB supports searching by field, range queries, and regular expression searches. Queries can be made to return specific fields within documents.
  • Indexing
    • Indexes can be created to improve the performance of searches within MongoDB. Any field in a MongoDB document can be indexed.
  • Replication
    • MongoDB offer high availability with replica sets. A replica set contains two or more mongo DB instances.
    • Each replica set member may act in the role of the primary or secondary replica at any time.
    • The primary replica is the main server which interacts with the client and performs all the read/write operations.
    • The Secondary replicas keep a copy of the data of the primary using built-in replication.
    • When a primary replica fails, the replica set automatically switches over to the secondary and then it becomes the primary server.
  • Load balancing
    • MongoDB uses the concept of sharding to scale horizontally by splitting data across multiple MongoDB examples.
    • MongoDB can run over multiple servers, balancing the load and/or duplicating data to keep the system up and running in case of hardware failure.

Mongodb Create Database

MongoDb

Mongodb Create Table Collection

MongoDb

Mongodb Insert Collection

MongoDb

Mongodb Select

MongoDb

Architecture of MongoDB NoSQL Database

MongoDb
  • Database :
    • It can be called the physical container for data.
    • Each of the databases has its own set of files on the file system with many databases existing on a single MongoDB server.
  • Collection :
    • A group of database documents can be called a collection. The RDBMS equal to a collection is a table.
    • The entire collection occurs within a single database. There are no schemas when it comes to collections. Inside the collection, many documents can have varied fields, but mostly the documents within a collection are meant for the same purpose or for serving the same end goal.
  • Document :
    • A set of key-value pairs can be selected as a document. Documents are associated with dynamic schemas.
    • The benefit of having dynamic schemas is that a document in a single collection does not have to possess the same structure or fields. Also, the common fields in a collection document can have varied types of data.

MongoDB Applications

  • Various technology use MongoDB as their Database Management System.
MongoDb


Related Searches to What is MongoDB - MongoDB Tutorial