NoSQL database
MongoDb is a NoSQL database which is much more agile and flexible than relational databases.
NoSQL vs SQL:
- Agile and flexible: schema is not required, and easy to change. Which usually cause better performance
- Ability to scale-out (distribute the load among multiple servers)
- To handle large volumes of structured, semi-structured, and unstructured data
Ref: SQL vs NoSQL: The Differences
Terminologies
Document: MongoDb stores data as BSON documents
Collection: analogous to an SQL table, to store a collection of documents
CRUD
Create
SQL
1 | INSERT INTO book ( |
MongoDb
1 | db.book.insert({ |
Read
SQL
1 | SELECT title FROM book |
MongoDb
1 | db.book.find( |
Update
SQL
1 | UPDATE book |
MongoDb
1 | db.book.update( |
Delete
SQL
1 | DELETE FROM book |
MongoDb
1 | db.book.remove({ |