
This lesson covers a beginner-friendly introduction to MongoDB, its features, and how it compares to SQL-based databases.
Topics covered in this lesson:
What is MongoDB? Understand MongoDB as a NoSQL database and its core functionalities.
SQL vs. NoSQL: Learn the key differences between these two database paradigms.
Relational vs. Non-relational Databases: Discover when to use relational (SQL) and non-relational (NoSQL) databases based on your project needs.
MongoDB Ecosystem: Get an overview of MongoDB's tools and features that make it a powerful choice for developers.
By the end of this video, you'll have a clear understanding of MongoDB and how it can be used effectively for modern applications.
Install the MongoDB community edition on Windows, set up the mongosh shell and compass, and configure the VS Code MongoDB extension for local development.
Connect to MongoDB using mongosh and Compass to manage databases and collections. Create and switch databases, add collections, and drop databases as shown.
Learn how to create databases, collections, and documents in MongoDB using mongosh and Compass, including insert one and insert many operations with fields like name, age, and salary.
Explore how MongoDB handles diverse data types in documents, including int, string, boolean, date, null, arrays, and an address document, with practical schema creation and insertion examples.
Explore MongoDB sorting and limiting data with find queries, using sort criteria plus one for ascending and minus one for descending, and applying limit to order by age or name.
Explore the find operator in MongoDB, applying query and projection filters, and using basic operators such as equal, not equal, greater than, and in to retrieve precise results.
Explore how to combine query conditions with logical operators in MongoDB, using and, or, not, and nor with age and salary to filter results.
Explore element query operators in MongoDB, focusing on exists to match field presence and type to filter by data type, with practical syntax and examples.
Learn how replace_one fully replaces a matching document in MongoDB, risks losing fields, and how to target a unique record (using the object ID) for safe replacements.
Master update one to modify specific fields using atomic update operators. Apply $set to change values or create fields and $unset to remove them, demonstrated with an id lookup.
Learn how to update specific fields in a MongoDB document using update one and atomic operators like $set and $unset, including creating and removing fields.
Demonstrate update many in MongoDB to update multiple records for Sita, Lakshman, and Arjun by name, setting full time to true, then add a gift field for full time employees.
Master how database indexes speed up queries by creating an index on the name field with createIndex in ascending order, and use explain with execution stats to see improved performance.
Learn how MongoDB Atlas, a fully managed cloud database, simplifies deployment and scaling. Create a free account, set up a cluster, and compare Atlas with the compass.
Install Python, set up a virtual environment, and install PyMongo to connect to MongoDB, then perform CRUD operations with PyMongo and verify the setup.
Learn to connect to a local MongoDB instance from Python using PyMongo in VS Code and Jupyter, by building a MongoClient with a local URI and testing with ping.
Connect your MongoDB Atlas cluster to a Python app with PyMongo, using the atlas connection string and a username and password. Verify the connection with a ping command.
Learn to connect PyMongo with MongoDB Atlas by loading a YAML config file, extracting the Atlas URI, and validating the connection with a ping.
Learn how to list databases, create a database and switch between it, create a collection, and insert a document using PyMongo with MongoDB Atlas.
Use PyMongo to print all documents by iterating over collection.find results and applying pretty print to display fields like ID, name, age, and salary.
Use PyMongo's insert_many to add multiple documents into a MongoDB collection, building a list of documents with fields such as name, age, and address. Verify by counting with find.
Master PyMongo's limit, sort, and skip to control query results, using ascending and descending order on fields like age and salary.
Explore how to use PyMongo's find operator for querying and projection, applying comparison operators such as $eq, and shaping results with projection controls.
Query documents with salary under 70000 using $lt and project name and salary fields in PyMongo. Filter not full time employees with $ne on full time field and project names.
Learn to query with in and not in operators, apply the find method with projection to display only names, and filter birthdays using date time and $gt.
Master PyMongo logical operators to combine conditions using $and and $or, querying age greater than 30 and salary at least 50,000, with name and salary projection.
Learn how to use PyMongo's logical operators $or, $not, and $nor to combine conditions, filter by age and name, identify non-full-time employees, and apply field projections.
Learn why rerunning PyMongo scripts can create duplicate records and how to prevent it by avoiding running all, dropping the database, and focusing on final queries.
Explore PyMongo's element query operators in MongoDB, focusing on $exists and $type to filter documents by field presence and data type, with practical examples.
Explore how to use PyMongo's array query operator $all to find documents whose array fields contain all specified elements, irrespective of order, with practical examples.
Explore how to query MongoDB arrays with PyMongo using $elemMatch to match documents where an array’s element meets multiple criteria, and use $size to filter arrays by length.
Learn how to use PyMongo update operations, including update one, update many, and replace one, with the $set operator to modify fields like full time on a single document.
Apply PyMongo update operations to modify documents using update one and update many, employing $set, $inc, and $unset to adjust salaries, remove fields, and add new fields based on conditions.
Connect to MongoDB Atlas with PyMongo, load emp.csv and tips.csv with pandas, convert to records-oriented documents, and insert into employee and tips collections using insert_many.
Learn how aggregation operations use pipelines of stages to group data, compute minimum, maximum, and average values, and pass results through successive stages to produce final results.
Learn to use the aggregate stage and the $match operator in PyMongo to filter documents in a pipeline, such as selecting records where sex is female.
Filter documents where sex is female and total bill is greater than $20 by applying the match operator in an aggregate pipeline using the and operator.
Explore the MongoDB aggregate group stage, using $group to cluster documents by a group key and compute totals with accumulators, producing one document per unique key in a pipeline.
Master multi-key grouping in MongoDB with PyMongo, using $group to sum tips by sex and time, including a two-stage pipeline that matches non-smokers.
demonstrates how aggregate stage $count tallies documents after a match, using a pipeline with tip amount >= 3 and an alias like 'count of documents' to return the total.
Discover how the $project stage in MongoDB aggregations displays existing fields, creates new ones, and uses expressions for arithmetic, concatenation, date formatting, and conditional logic.
Explore MongoDB aggregation with PyMongo by using the $project stage to display employee id, total bill, and tip while excluding _id, and to create a concatenated day and time field.
Use a $project stage to exclude _id, include employee_id, and add a static restaurant_id with a literal; then sum total_bill and tip to create bill tip combined using add operator.
Learn to use the MongoDB $project stage in an aggregation pipeline to compute a 10% discount on total bill, add discount_bill_value, and derive total_bill_after_discount while excluding the id.
Create a tip bucket in MongoDB's aggregation pipeline using the condition operator to implement an if-then-else that marks tips as high or low by value.
Learn the second syntax for the MongoDB $cond operator, using a boolean expression with a true and false case in a list to drive if-then-else logic.
Learn to use the $switch operator in a MongoDB projection to bucket total bill as high, medium, or low across multiple conditions with a default unknown.
Learn to combine project and group stages in a MongoDB aggregation pipeline to count documents by bill bucket values (high, medium, low) using a sum accumulator.
Discover how to use the addFields stage in MongoDB aggregation to add new fields, compute totals like total spend, and create conditional buckets such as tip bucket.
Explore the MongoDB aggregate $fill stage to populate null and missing fields, with syntax options and examples using linear, forward, and backward fill to set missing size to one.
Explore linear interpolation to estimate unknown values between data points using a straight line, the slope formula m = (y1−y0)/(x1−x0), and y = y0 + m(x−x0) in MongoDB.
Explore how to fill missing average IQ scores using the linear interpolation method in MongoDB aggregation, including sorting by start age and estimating values such as 100 and 105.
Learn how last observation carry forward (locf) uses forward fill and backward fill to estimate missing values, with sorting documents and filling values in a MongoDB workflow using PyMongo.
Learn to fill missing average IQ score using forward fill and backward fill with the $fill stage, sorting by a numerical field to carry the last observation forward or backward.
Explore how to fill missing values in MongoDB using the $fill stage, with partition by and sort by, applying forward fill, backward fill, or linear interpolation.
Learn how to use the $sort and $limit operators in MongoDB's aggregate stage, sorting documents ascending or descending and selecting the top results with a pipeline.
Explore the $merge stage, which writes aggregation results to a specified collection or database, with on-field matching and options to insert, replace, merge, discard, or fail when matched or not.
Learn to use MongoDB's aggregate $merge with PyMongo to merge documents into tips copy collection in my save data database, and create a tip bucket field bucketing by tip values.
Demonstrates the merge operator in the aggregation stage, covering when matched and when not matched behaviors, including merge, replace, keep existing, insert, discard, and fail options.
Explore MongoDB text search techniques, including regular expression based search, direct text search with $text, and vector search with embeddings using approximate and exact nearest neighbor methods.
Explore regex based search in MongoDB, including pattern matching in find and match stages, Atlas UI vs PyMongo syntax, options like I, M, X, S, and common metacharacters.
Apply PyMongo regex queries to document fields, using patterns and options for case-insensitive and multi-line searches, with practical examples like hyphenated names, Gmail addresses, .edu/.org domains, and amounts in nodes.
Explore how MongoDB's $text full text search uses NLP techniques like tokenization, normalization, diacritic sensitivity, case sensitivity, stemming, and stop-word removal to score and rank documents with language options.
Explore how tokenization, normalization, stopword removal, and stemming prepare documents for tf-idf scoring, and demonstrate calculating text score for a sample query.
Learn to implement MongoDB full text search with PyMongo, including case sensitive and case insensitive searching, multi-term and exact matching, stemming, diacritic sensitivity, and text score.
Shows how to use MongoDB's $text for full text search with pymongo, covering basic searches, case and diacritic options, exact phrases, language and stemming, and text score.
Download the Notebooks, PPT and Data on
Introduction to Vector Database
LangChain with LLM
MongoDB Atlas as Vector Database and RAG
Explore vector databases with MongoDB Atlas and semantic search that uses vector embeddings to retrieve conceptually related data, not just keywords.
Explore how to measure vector similarity using dot product, cosine similarity, Euclidean distance, and Manhattan distance, including magnitude, direction, and normalization concepts.
Explore how to compute similarity measures, dot product, cosine similarity, Euclidean distance, and Manhattan distance, between vectors like king, queen, dog, and puppy, to identify the closest vector.
Learn to perform MongoDB vector search using exact and approximate nearest neighbor methods, leveraging cosine similarity, dot product, and Euclidean distance in aggregated pipelines with index search models.
Demonstrates setting up a MongoDB Atlas vector search with toy movie data, creating eight-dimensional embeddings, building a vector index, and querying with cosine similarity via an aggregate pipeline.
Discover LangChain, a universal library that unifies open and closed LLM providers, enabling prompt templates, the drag component for retrieval and vector search with MongoDB Atlas.
Install LangChain dependencies in the Visual Studio Code terminal, including MongoDB and OpenAI integrations, then load a PDF and convert it into embeddings for MongoDB storage.
Create an OpenAI API key, review model pricing, set up billing with a $5 credit, and securely copy and store the secret key for OpenAI model access.
Set the OpenAI API key and Atlas connection string as environment variables using bash exports on Linux/macOS and set X on Windows, then verify with echo.
Connect LangChain to OpenAI with your api key, import the chain in a Jupyter notebook, and experiment with a completion model and embedding models.
Explore how temperature and max tokens control OpenAI outputs, showing how lower temperatures yield stable results while higher values boost creativity, and how token limits shape response length.
Explore the LangChain chat OpenAI model by building a chat interface with user, assistant, and system roles, and crafting prompts using system and human messages.
Master retrieval augmented generation with Langchain by mastering indexing, retrieving, and pre-processing documents into chunks and embeddings stored in MongoDB for effective llm insights.
Load text and PDF documents with LangChain document loaders, extracting page content and metadata. Prepare the text into chunks and embeddings for a vector database in Python using lm.
Learn how to split text and PDF documents into chunks using LangChain's recursive character text splitter, configuring chunk size and overlap to preserve context.
Extract text from documents and generate embeddings using the OpenAI embeddings model with embed documents and embed query, detailing model selection and dimension control to prepare for MongoDB Atlas storage.
Plan to create a rag model in MongoDB Atlas using vector search. Build a book-based vector store with 512-dim embeddings, chunked text, and cosine similarity queries.
Connect to MongoDB Atlas via a Python notebook, create MongoDB book database and collection, and set up Atlas Vector Search index with a 512-d text embeddings field and cosine similarity.
Load the MongoDB handbook and extract its text. Use the py pdf loader after connecting to the MongoDB client and setting up the database, collection, and search index model.
Create 94 document chunks from 66 documents using a recursive character text splitter with a chunk size of 1000 and 20% overlap. This prepares for generating embeddings from the chunks.
Generate 512-dimensional embeddings from document chunks using OpenAI embeddings in a LangChain workflow, producing 114 vectors ready for database insertion in the next lesson.
Learn how to store document chunks and their embeddings in a MongoDB Atlas vector search collection using long chain's from_documents, configure the embedding model, and verify indexing.
Master vector search on embeddings in MongoDB Atlas by building a two-stage aggregate pipeline, generating a query embedding, and projecting text, page, and similarity scores.
Learn to perform vector search in MongoDB Atlas using Langchain by directly querying the object vector store, performing similarity search with score, and retrieving metadata and page content.
Mastering: MongoDB Atlas Vector Database: Zero to Advanced with Python
This comprehensive course takes you from MongoDB fundamentals to advanced AI-powered vector databases. Perfect for beginners and enthusiasts wanting to master modern database techniques and AI integration.
Course Sections
Section 1: MongoDB Fundamentals Master MongoDB basics using Shell and Compass. Learn database setup, CRUD operations, and core concepts.
Section 2: PyMongo & Advanced Queries Dive into Python integration with PyMongo. Build complex queries performed in MongoDB Atlas
Section 3: Aggregate Pipeline in Atlas Deep dive into aggregate pipeline and stages like groupby, project, match, conditional statements, switch case and many more.
Section 4: Search Techniques Explore text search, regex patterns, and full-text search capabilities within MongoDB.
Section 5: MongoDB Atlas & Vector Search Transition to cloud with MongoDB Atlas. Implement vector embeddings for similarity search and semantic applications.
Section 6: Introduction to Langchain with OpenAI LLMs there we give you introduction to LangChain OpenAI and how to generate the text and get embeddings using sophisticated OpenAI and API keys.
Section 5: RAG Systems Build intelligent Retrieval-Augmented Generation systems combining traditional databases with AI technologies in MongoDB Atlas.
Tools & Resources
Technologies: MongoDB Shell, Compass, PyMongo, MongoDB Atlas, Vector Search, LangChain, OpenAI Embeddings
Included Materials:
Complete Jupyter notebooks with step-by-step code
Sample datasets and real-world data
Configuration files and connection scripts
Project templates and starter code
Documentation and reference guides
Hands-on exercises and solutions
All code examples, datasets, and resources provided for immediate hands-on practice.