What is MongoDB?
MongoDB is a NoSQL document database that stores data in JSON-like BSON documents instead of tables.
SQL: Tables-> Rows -> Fixed Schema -> JOIN
MongoDB: Collections -> Collections -> Documents -> Flexible Schema -> $lookup
A document is a JSON-like object stored inside a collection.
A collection is a group of documents (similar to a table in SQL).
Every MongoDB document has a unique
_idfield automatically generated.BSON is Binary JSON, the format MongoDB uses internally to store data.
MongoDB Queries :
db.users.find() -> Find all users
db.users.find({ age: 25 }) -> Find user by age
db.users.insertOne({ name: "Zahid",age: 28}) -> Insert document
db.users.updateOne({ name: "Zahid" }, { $set: { age: 29 } }) -> Update user
db.users.deleteOne({ name: "Zahid" }) -> Delete User