Understanding MongoDB :
MongoDB is an agile and scalable NoSQL database. The name Mongo comes from the word humongous. MongoDB is based on the NoSQL document store model, in which data objects are stored as separate documents inside a collection instead of in the traditional columns and rows of a relational database. The documents are stored as binary JSON or BSON objects.
The motivation of the MongoDB language is to implement a data store that provides high performance, high availability, and automatic scaling. MongoDB is extremely simple to install and implement, as you will see in upcoming posts. MongoDB offers great website back-end storage for high-traffic websites that need to store data such as user comments, blogs, or other items because it is fast, scalable, and easy to implement.
- MongoDB is an open-source database developed by 10gen, for a wide variety of applications.
- Document oriented : Because MongoDB is document oriented, the data is stored in the database in a format that is very close to what you will be dealing with in both server-side and client-side scripts. This eliminates the need to transfer data from rows to objects and back.
- It is an agile database that allows schema's to change quickly as application evolve. It means that MongoDB has flexible schema / dynamic schema.
- High performance : MongoDB is one of the highest-performing databases available. Especially in today’s world, where many people interact with websites, having a back end that can support heavy traffic is important.
- Replication & high availability : MongoDB’s replication model makes it easy to maintain scalability while keeping high performance and scalability. Below figure shows the "Basic replication set in MongoDB". The green color box is Primary, where all write operations are going and maroon color boxes are Secondary, which will get replicated from Primary.
Fig : Replication in MongoDB
- High scalability : MongoDB’s structure makes it easy to scale horizontally by sharding the data across multiple servers.
Fig : Sharding in MongoDB
- By leveraging in-memory computing i.e. MongoDB processes most of the queries in-memory it-self, that's why it is so fast.
- MongoDB's native replication and automated fail-over enables reliability and flexibility.
- MongoDB written in C++. (That's why it is light weight)
- MongoDB has got full index support. We will see what are all the indexes MongoDB supports in "INDEXES" posts.
- MongoDB supports Map - Reduce functions also. We will see in detail in our upcoming posts.
- Grid FS : It is the solution from MongoDB to store large files like Video files, audio files, images etc.
MongoDB features :
- MongoDB has got support from almost all programming languages like Java, Python, Ruby etc. In this tutorial we will use Python.
- Hadoop Integration.
- Aggregation framework and native Map-Reduce.
- Rich secondary indexes, including geospatial and TTL (Time To Live) index.
- Built-in replication for high availability.
- Auto sharding for horizontal scaling.
- JSON data model with Dynamic/Flexible schema.
MongoDB Database :
Mongod is the primary daemon process for the MongoDB system. Database is the physical container for collections. Each database gets its own set of files on the file system. It acts as a server, typically has multiple databases. It handles data requests, manages data format and performs background management operations.
Collections in MongoDB :
MongoDB groups data through collections. A collection is simply a grouping of documents that have the same or a similar purpose. A collection acts similarly to a table in a traditional SQL database. However, it has a major difference: In MongoDB, a collection is not enforced by a strict schema. Instead, documents in a collection can have a slightly different structure from one another, as needed. This reduces the need to break items in a document into several different tables, as is often done in SQL implementations.
Fig : MongoDB collections in a single database
Documents in MongoDB :
A document is a representation of a single entity of data in the MongoDB database. A collection consists of one or more related objects. A major difference exists between MongoDB and SQL, in that documents are different from rows. Row data is flat, with one column for each value in the row. However, in MongoDB, documents can contain embedded subdocuments, providing a much closer inherent data model to your applications.
In fact, the records in MongoDB that represent documents are stored as BSON, a lightweight binary form of JSON. It uses field:value pairs that correspond to JavaScript property:value pairs that define the values stored in the document. Little translation is necessary to convert MongoDB records back into JSON strings that you might be using in your application.
For example, a document in MongoDB might be structured similar to the following, with title, Author, Company, Posts, Comments and Views fields:
Fig : A sample document in MongoDB
For more details on JSON, I recommend you to visit http://json.org/
RDBMS terminology with MongoDB :
I hope that below table is self explanatory. Just have a look.
**_id field is mandatory filed in MongoDB document i.e. you can't have any document in MongoDB without having _id field. It acts as a Primary key. User need not to insert "_id" field while creating MongoDB collection i.e. MongoDB inserts _id field to the each document automatically.
**MongoDB doesn't support joins and transactions. Don't worry, we will discuss more on this when we talk about "Schema design in MongoDB".
Note : From MongoDB 3.2 left joins are supported through the $lookup operator. (But conditions apply)
** Next Post : "MongoDB installation on windows"
This is a nice blog, this is a very useful content. I like your post
ReplyDeleteFull Stack online Training
Full Stack Training
Full Stack Developer Online Training
Full Stack Training in Hyderabad
Full Stack Training in Ameerpet
Good Post Thanks for sharing this blog. Keep on sharing.
ReplyDeleteMean stack online training
Mean stack training in hyderabad
Your blog is in a convincing manner, thanks for sharing such an information with lots of your effort and time
ReplyDeletemongodb online training
mongodb online course
mongodb training
mongodb course
Thanks for the post. keep sharing..
ReplyDeleteMachine Learning training in Pallikranai Chennai
Data science training in Pallikaranai
Python Training in Pallikaranai chennai
Bigdata training in Pallikaranai chennai
Spark with ML training in Pallikaranai chennai
I am stunned by the information that you have on this blog. It shows how well you fathom this subject.
ReplyDeletehttps://360digitmg.com/masters-in-full-stack-data-scientist-course/
The information on mongoDB is so interesting, if you want to search for more information on topics like this, check out data science course in bangalore they provide training and knowledge with regards to Data Science, Machine Learning, Artificial Intelligence
ReplyDeleteGreat, thanks for sharing this post.Much thanks again. Awesome.
ReplyDeletedata science online free
Best Data Science Online Training
MongoDB Interview Questions and Answers
ReplyDeleteMongoDB is the top priority for organisations when it comes to using a NoSQL database. It is challenging to load and access data into RDBMS using object-oriented programming languages. Mongodb is a simple database that you may learn via Nextstacks, also you will get certificate.
ReplyDelete