Basic CRUD, Projection, Embedded/Nested Documents, Array
Exploring The Shell and The Server
Create/Insert, Write concern, Atomicity
Performance Fault Tolerancy Deployment
SKIPPED
- Shell to drive
- Introducing Stitch
- Store data as documents like JavaScript Object
- noSQL database
- Store like JSON
- BSON (b ⇒ binary) Data Structure into server
- No schema(can add if wanted)
- No / few relations
- Flow of data
- Database
- Collection(Like table)
- Document(like JSON object values these are schemaless
Normalizing: Storing and distributing data in multiple tables where every table has a clear schema and use lots of relations(in SQL).
As MongoDB saves all in one single document so for fetching it does not need any complex operation like join(SQL) so MongoDB can fetch query is more simple, more flexible, and more efficient(as no need to merge collection/table) than SQL.
MongoDB is popular for read and write heavy applications (like sensors which send data every second/online shop/blog).
mongo
show dbs
Will connected with database name 'shop' if already exits or if the database is not exited yet MongoDB will create that
use shop
Output will be
switched to db shop
Note: If the database is not created previously this command will create that database but the shop database will not create instantly(as a result show dbs
will not list shop db). When we will first add data to the shops database than MongoDB implicitly will create that database and also show dbs
commands that will list the database.
Will give all data as we add not add any argument.
db.products.find()
Will return exactly the same data as JSON like format which is easy to read.
db.products.find().pretty
cls
- Self - Managed / Enterprise
- CloudManager / OpsManager
- Atlas(Cloud)
- Mobile
Others options
- Compass
- BI Connectors
- MongoDB Charts
That gives
💡 **Serverless Query Api** **⇒** a tool sets or tools to directly database query from inside client apps. 💡 **Serverless Functions(in the cloud ⇒ related to js) ⇒** a tool sets or tools to directly database query from inside client apps. 💡 **Database Triggers ⇒** that allows us to events in a database, like a document was inserted and then execute a function in response to that and that function could then maybe send an e-mail. 💡 **Real-Time Sync ⇒** basically is built to synchronize a database in a cloud with that mobile offline supporting database.- Frontend(UI)
- Backend(Server) ⇒ Which interacts/communicates with MongoDB server using their corresponding drivers
- Node.js
- Java
- Python
- MongoDB Shell(does not depends on any specific programming language).
- MongoDB server
- MongoDB server use a storage engine default for MongoDB is Wired Tiger. Which access file/data where the data kept(database information collection, table, etc)
- Storage Engine
- Read + Write Data to Files(slow)
- Read + Write Data in Memory(fast) ⇒ Memory(RAM)
- Storage Engine
- MongoDB server use a storage engine default for MongoDB is Wired Tiger. Which access file/data where the data kept(database information collection, table, etc)
JSON data converts into BSON data
{ "name" : "MAX", "age" : 29 }
it converts into BSON
BSON
- Binary data
- Extends JSON Types(e.g more detailed Number Types)
- Efficient Storage
mongo is a command line shell that can interact with the client (for example, system administrators and developers).
sudo mongod => To start in default port
sudo mongod --port 27018 => can use if in any case default port 27017 not available
mongo => to start in default port 27017
mongo --port 27018 => to start at 27018 port