Introduction to MongoDB
What is NoSQ:?
NoSQ: = Not Only SQL
NoSQL will also have relations but in different way.
CAP Theorem
Consistency - data should be same on all the nodes.
Availability - Node or system should be available at time.
Consistency and Availability does not need to happen at same time.
Partition Tolerance: means system does not faild regardless of any data delay or droped in nodes in a system.
MongoDB has Consistency and Partition Tolerance did care much about Availability.
Types of NoSQL Databases
Relational Database
Document Database Stores data in the form of JSON. MongoDB and CouchDB
Key-Value Database radis and DynomoDB
Wide-Column Stores have dynamic columns. each row don’t have to have same amount of columns casandraDB, hbase,
Graph Databases stores data into nodes and edges, nodes stores information people place or various things that we typically stores in to relational database. edges stores relationship between thoso nodes. graph databases are great when we want to look for patterns like fraud detection or social networking. neo4j and genis graph
Advantages of Document Database
Intutive Data Model Data Access Together, Store Together Flexible Schema Self Describing Universla JSON documents Query Data Anyway Indexing, realtime aggregation ACID transactions very rich indexing Distributed Scalable Database Horizontal Scalling Native sharding can store data into different geography
Why use MongoDB?
Open source and Free (Community Ed) Document Databases document is native type language Hight performance Rich Query Language High Availability Horizontal Scalability Supports Multiple Storage Engine (Memory Storage engine, third party storage engines)
SQL Terms Vs MongoDB Terms
SQL Terms | MongoDB Terms |
---|---|
Database | Database |
Table | Collection |
Row | JSON/BSON Document |
Column | Field |
Index | Index |
JSON vs BSON
Heading | Javascript object notation | Binary JSON |
---|---|---|
Encoding | UTF-8 String | Binary |
Data Support | String, Boolean, Number, Array | String, Boolean, Number, Array, Date, Raw Binary |
Readability | Human and Machine | Machine Only |