MongoDB Workshop
Self-Reflection
Recently , I had a two — days workshop on MongoDB delivered by our mentor Vimal Daga Sir.
I want to share the knowledge that I gained in this workshop.
Introduction
MongoDB is an open-source document database and leading NoSQL database, which means it stores data in JSON-like documents. It is best for Big Data where the volume, velocity, and variety of data is too high.
Database
The database is a physical container for collections. A single MongoDB server can have multiple databases. The database can contain multiple collections.
Collection
A collection is a group of documents. It is the equivalent of an RDBMS table. A collection exists within a single database. Collections don’t have schema like RDBMS, collections are schema-less in MongoDB and that’s the great thing about MongoDB. A single collection can have multiple documents.
Cluster
A cluster is a group of interconnected nodes ofter nodes are independent systems that share storage and resources.
Document
A document is in JSON and that consists of key-value pairs. Documents have dynamic schema. Dynamic schema means that documents in the same collection do not need to have the same set of fields or structure, and common fields in a collection’s documents may hold different types of data. It can be changed at any time according to the data.
How to interact with MongoDB server?
Three ways to interact are as follows -
- Command Line Interface
- Graphical User Interface (Compass)
- Application Program Interface (Any programming language)
Indexes in MongoDB
Indexes are used to retrieve data quickly. In this case, we search the documents using indexes
What is the primary key?
The Primary Key is a unique key assigned to every document. In MongoDB primary key can be “_id”
Aggregation Pipeline
The aggregation pipeline is a framework for data aggregation modeled on the concept of data processing pipelines. Documents enter a multi-stage pipeline that transforms the documents into aggregated results. We have 3 stages in this pipeline
- $match
The $match stage can use an index to filter documents if it occurs at the beginning of a pipeline. - $sort
The $sort stage can use an index as long as it is not preceded by a $project, $unwind, or $group stage. - $group
The $group stage can sometimes use an index to find the first document in each group if all of the following criteria are met:
MongoDB Atlas
MongoDB Atlas is a cloud platform provided by MongoDB where we can create our cluster.
THANK YOU…!!
#mongodb #mongodbbylw #righteducation #vimaldaga #worldrecordholder #mongodbworkshop #workshop