Learning MongoDB
MongoDB
is a type of NoSQL database suitable for storing large-scale data.
MongoDB is a document based database, the data is stored in a JSON-like document format.
MongoDB uses Collections to organize documents, and each document is composed of key-value pairs.
Concepts
Database: A container for storing data, similar to a database in relational database.
Collection: A collection in database, similar to a table in relational database.
Document: A data record in a collection, similar to a row in relational database, stored in BSON format.
mapping:
SQL Concept | MongoDB Concept | Remark |
---|---|---|
database | database | database |
table | collection | databse table/collection |
row | document | data record |
column | field | data field |
index | index | index |
table joins | MongoDB not supported | |
primary key | primary key | MongoDB will set _id to primary key |
Installation
1 | # install community edition |
MongoDB Shell
1 | # start mongo shell |
Basic Operations
1 | # show current database |
MongoDB Tools
- MongoDB Compass: A free GUI tool.
- Navicat: A paid GUI tool.
- Studio 3T: A paid GUI tool, with a good CRUD operations experience.