MongoDB Explained at Beginner Level

What is MongoDB ?

MongoDB is a free and open-source cross-platform document-oriented database program . classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. MongoDB is developed by MongoDB Inc and is published under a combination of the GNU Affero General Public License and the Apache License.



The Nexus Architecture of MongoDB  



 1. Expressive Query Language and Secondary Indexes : Users should be able to access and manipulate their data in sophisticated ways to support both operational and analytical applications. Indexes play a critical role in providing efficient access to data, supported natively by the database rather than maintained in application code.

2. Strong ConsistencyApplications should be able to immediately read what has been written to the database. It is much more complex to build applications around an eventually consistent model, imposing significant work on the developer, even for the most sophisticated engineering teams.

3. Enterprise Management and Integration : Databases are just one piece of application infrastructure, and need to fit seamlessly into the enterprise IT stack. Organizations need a database that can be secured, monitored, automated, and integrated with their existing technology infrastructure, processes, and staff, including operations teams, DBAs, and data analysts.

4. Flexibility : NoSQL databases emerged to address the requirements for the data we see dominating modern applications. Whether document, graph, key-value, or wide-column, all of them offer a flexible data model, making it easy to store and combine data of any structure and allow dynamic modification of the schema without downtime or performance impact

5. Scalability  and Performance : NoSQL databases were all built with a focus on scalability, so they all include some form of sharding or partitioning. This allows the database to scale out on commodity hardware deployed on-premises or in the cloud, enabling almost unlimited growth with higher throughput and lower latency than relational databases.

6. Always-On Global Deployments : NoSQL databases are designed for highly available systems that provide a consistent, high quality experience for users all over the world. They are designed to run across many nodes, including replication to automatically synchronize data across servers, racks, and data centers.

Why Use MongoDB ?



1. Document Oriented Storage - Data is store in the form of json style documents
2. Index on any attribute 
3. Replication and high availablity
4. Auto-sharding
5. Rich Queries
6. Fast in-place updates
7. Professional support by MongoDB  

Where to Use MongoDB ?



1. Big Data
2. Content Management and Delivery
3. Mobile and Social Infrastructure
4. User Data Management
5. Data Hub
 
Stucture of Data Stored in MongoDB

This is the JSON Type Structure the document structure of a blog site, which is simply a comma separated key value pair. _id is a 12 bytes hexadecimal number which assures the uniqueness of every document. You can provide _id while inserting the document. If you don’t provide then MongoDB provides a unique id for every document. These 12 bytes first 4 bytes for the current timestamp, next 3 bytes for machine id, next 2 bytes for process id of MongoDB server and remaining 3 bytes are simple incremental VALUE.



Make Development Easy  (Support Python,Java,C++,C#,Javascript)

Here Is The Example How to implement MongoDB using Java

Step 1 : Connect - Here we are connecting to a locally hosted MongoDB database called test with a collection named restaurants.

 
Step 2 : Insert a document - 5 example document are being inserted into the restaurants collection. Each document represents a restaurant with a name,star rating and categories(stored as an array)  

 
Step 3 : Create a query - In this example, we run a simple query to get all the document in the restaurants collection and store them as an array 

 
Step 4 : Build an Index - Indexes in MongoDB are similar to indexes in other database systems. MongoDB supports indexes on any field or sub-field of a document in a collection. Here, we are building an index on the name field with sort order ascending 


Step 5 : Aggregate - Using MongoDB’s aggregation pipeline, you can filter and analyze data based on a given set of criteria. In this example, we pull all the documents in the restaurants collection that have a category of Bakery using the $match operator and then group them by their star rating using the $group operator. Using the accumulator operator, $sum, we can see how many bakeries in our collection have each star rating.


Some Basic Operation of MongoDB

1. Create Database
2. Drop Database
3. Create Collection
4. Drop Collection
5. Insert Document
6. Query Document
7. Projectin
8. Indexing
9. Aggregation
10. Create Backup
  
Some TopmVendors Who Uses the MongoDB

1. Cisco


2. Expedia

3. MetLife


and so on...

If You have any query related to this article please let me know in the comment section And suggestion is always welcome 
 
Posted By : Tushar Verma 
Official Link : https://www.blockchain.com/  
Documentation Link : https://docs.mongodb.com/
LinkedIn Profile  : https://www.linkedin.com/in/tushar-verma-047329154/

Komentar

Postingan Populer