technical skills grow

Responsive Ads Here

Tuesday, December 5, 2023

Introduction to MongoDB

 What is MongoDB
Source-available, cross-platform and document-oriented database program 
Name derived from keyword “humongous” 
Written in C++, JavaScript, Python
Uses JSON-like documents with optional schemas 
Developed by MongoDB Inc. and licensed under the Server Side Public License (SSPL)
 
History of MongoDB
In 2007, “10gen” software company
In 2009, company shifted to an open-source development model 
In Feb 2009, MongoDB’s initial and official release 
In 2013, 10gen changed its name to MongoDB Inc.
In 2014, MongoDB acquired WiredTiger

Key Features of MongoDB 

High Performance 

Rich Query Language 

High Availability 

Horizontal Scalability 

Support of multiple Storage Engine

RDBMS vs MongoDB
 
 

 

Introduction to CAP theorem
CAP theorem
Consistency, Availability, Partition tolerance 
Brewer’s Theorem after computer scientist Eric Brewer 
A distributed system can deliver only two of three desired characteristics 
In the presence of a network partition, one has to choose between consistency   and availability
 
CAP theorem
Consistency 
All clients see the same data at the same time
Every read receives the most recent write or an error
Availability 
Any client making a request for data gets a response 
Every request receives a (non-error) response
Partition tolerance  
A communications break within a distributed system
The system continues to operate despite messages being dropped (or delayed)
 

 
Introduction to JSON 
JavaScript Object Notation
Simple associative containers 
A string key is mapped to a value 
Human and machine-readable
Comparatively simple to implement support for 
JavaScript became the default language of client-side web development 
JSON shows up in many different 
cases:
 APIs
 Configuration files
 Log messages 
Database storage
 JSON Examples 
Simple Key –Value pairs
 { 
“name”: “MongoDB”, 
“type” : “Document-based NoSQL Database” 
  }
Key – Array value pairs 
{
 “name”: “MongoDB”,
 “tags” : [“Document”, “NoSQL”, “Database”, “Leaf”] 
} 
 
JSON Examples 
Key – Embedded value pair 
{ 
"name" : {
 "first" : "John",
 "last" : “Adams" 
   }
 }
 
JSON Examples 
Key –Array of Embedded value pairs 
{
 "awards" :[
 {"award" : "W.W. McDowell Award",
 "year" : 1967, 
"by" : "IEEE Computer Society"
 }, 
{"award" : "Draper Prize",
 "year" : 1993, 
"by" : "National Academy of Engineering" 
}
] }
 
MongoDB Document
Data records as BSON documents 
Composed of field-and-value pairs 
Field can be any of the BSON data types 
Value can be other documents, arrays, and arrays of documents 
It is similar to JSON document 
Can have more than one field with the same nameThe maximum BSON document size is 16 megabytes.
_id is primary key, auto-created 
 
 

 
 

No comments:

Post a Comment

Powered by Blogger.

Labels

Contact Form

Name

Email *

Message *

Search This Blog

Blog Archive

Ad Code

Responsive Advertisement

Recent Posts