MongoDB Async: Concurrent Data Handling for Python Devs Course

Course Summary

MongoDB is one of the most exciting data technologies. You can build extremely high performance apps with the joy of a schemaless lifestyle. Python is the perfect counterpart to MongoDB. In this course, we feature the latest Python frameworks and techniques for working with MongoDB: The Beanie ODM (object-document mapper), Pydantic, FastAPI, Locust load testing, and Python's async and await capabilities.

What students are saying

Highly recommended, very nice flow of concepts, modern dev tools, and packs a lot of content into a short space.
-- Alan

Source code and course GitHub repository

github.com/talkpython/mongodb-for-async-python-course

What's this course about and how is it different?

This course will teach you how to use MongoDB and document databases to build simpler and faster data-driven applications.

We start by explaining the origin and major concepts of NoSQL and document databases. You then learn how to work with MongoDB from its native shell as well as many of the CLI and GUI management tools.

Many MongoDB courses stop there. This course is meant to be a practical end-to-end coverage of MongoDB. We go beyond scratching the surface by covering real-world topics.

You'll see how to use Beanie (a popular ODM for MongoDB - think ORM for NoSQL) to map classes to MongoDB. Beanie is based on state-of-the-art Python technologies such as Pydantic and Python's async and await.

In this code-based and hands-on, demo-driven course, we will build some simple example apps using Beanie. Then we'll move on to modeling real PyPI data with 100,000s of records in MongoDB. Once we have our Python code working with the PyPI data, we'll build out a full FastAPI API around the data showing the smooth integration of Beanie and async MongoDB within FastAPI.

After we master working with MongoDB from Python, we'll turn our attention to performance. We take a large database with millions of data points and make it run hundreds of times faster than you get out-of-the-box with MongoDB. We test our performance changes with both custom Python code and the Locust load testing framework.

We wrap up the course by deploying MongoDB to production Linux servers. There are a few very important steps to getting MongoDB running in production and we'll go step-by-step through this setup.

In the end, you'll be ready to start building and running high-performance, MongoDB-backed, data-driven applications.

View the full course outline.

What will you learn?

In this course, you will:

  • How document databases, such as MongoDB, work
  • Where MongoDB fits in the larger scope of databases used in the world
  • How to install and configure MongoDB and several management tools and GUIs
  • A basic set of MongoDB's native shell commands and queries
  • Foundational technologies such as Pydantic and Python's async and await
  • How to design data models with Beanie and Pydantic
  • Understand the tradeoffs when modeling data with documents
  • Learn when it's a good idea (and when it's a bad one) to embed data within other records
  • Use ORM-style programming with MongoDB and Beanie
  • Use more efficient "in-place" operations such as addToSet with Beanie
  • Design projection classes in Pydantic for improved performance
  • How to safely store user accounts (namely passwords) in MongoDB
  • To deeply integrate Beanie and MongoDB with FastAPI
  • Create complex indexes in MongoDB from Beanie for 1000x performance boosts
  • Use indexes to enforce data integrity in MongoDB
  • Safely deploy MongoDB in a self-hosted environment within a cloud provider on multiple Linux machines
  • Use the load testing framework Locust to probe and test the performance limits of your MongoDB-based web APIs
  • And lots more

  • View the full course outline.

Who is this course for?

For anyone who wants to use the latest Python technologies to work with MongoDB.

As for prerequisites, we assume:

  • Basic familiarity with the Python programming language and core tools (e.g. pip)
  • That you have very minimal understanding and experience with some database technology (relational or NoSQL)

The tools chosen and featured during this course are 100% free and most of them are open source or have free and solid alternatives.

Concepts backed by concise visuals

While exploring a topic interactively with demos and live code is very engaging, it can lose the forest for the trees. That's why when we hit a new topic, we stop and discuss it with concise and clear visuals.

Here's an example that visually compares the top-level data in a document database to the embedded and nested objects within that same record for MongoDB.

Example: Concepts backed by concise visuals

Follow along with subtitles and transcripts

Each course comes with subtitles and full transcripts. The transcripts are available as a separate searchable page for each lecture. They also are available in course-wide search results to help you find just the right lecture.

Each course has subtitles available in the video player.

Who am I? Why should you take my course?

Who is Michael Kennedy?

My name is Michael, nice to meet you. ;) There are a couple of reasons I'm especially qualified to teach you Python.

 1. I'm the host of the #1 podcast on Python called Talk Python To Me. Over there, I've interviewed many of the leaders and creators in the Python community. I bring that perspective to all the courses I create.

 2. I've been a professional software trainer for over 10 years. I have taught literally thousands of professional developers in hundreds of courses throughout the world.

 3. Students have loved my courses. Here are just a few quotes from past students of mine.

"Michael is super knowledgeable, loves his craft, and he conveys it all well. I would highly recommend his training class anytime." - Robert F.
"Michael is simply an outstanding instructor." - Kevin R.
"Michael was an encyclopedia for the deep inner workings of Python. Very impressive." - Neal L.

Free office hours keep you from getting stuck

One of the challenges of self-paced online learning is getting stuck. It can be hard to get the help you need to get unstuck.

That's why at Talk Python Training, we offer live, online office hours. You drop in and join a group of fellow students to chat about your course progress and see solutions via screen sharing.

Just visit your account page to see the upcoming office hour schedule.

This course is delivered in very high resolution

Example of 1440p high res video

This course is delivered in 1440p (4x the pixels as 720p). When you're watching the videos for this course, it will feel like you're sitting next to the instructor looking at their screen.

Every little detail, menu item, and icon is clear and crisp. Watch the introductory video at the top of this page to see an example.

The time to act is now

MongoDB is one of the most wanted and loved databases. It's far and away the most popular document database. This course presents the best, most cutting-edge frameworks for building MongoDB powered apps with Python. Dive in to learn the skills you need gain true mastery over MongoDB.

Course Outline: Chapters and Lectures

Welcome to the Course
20:21
Introducing the Course
0:53
MongoDB is Loved
3:06
MongoDB is fast
3:44
Python's asyncio
2:41
What is Beanie and What is an ODM?
4:28
Course Topics
3:44
Meet Your Instructor: Michael Kennedy
1:15
PyCharm Pro for Free
0:30
Setting Up Your Computer
10:57
Setup Introduction
2:22
Installing MongoDB
2:14
Studio 3T GUI
1:16
Importing PyPI Data
2:35
Verifying the Data with Studio 3T
2:30
Document Databases
24:17
Document Dbs introduction
1:03
How Document Databases Work
3:26
Who uses MongoDB?
3:01
Mongo Shell
2:12
A More Complex Query
1:34
And Operators in Queries
1:08
Querying Embedded Data
1:41
Studio 3T: A Better Shell
2:04
Query Operators
2:55
Queries: Logical Operators
0:49
Queries: Projections
4:24
Foundations: Pydantic
27:21
Pydantic Introduction
0:49
A Time of Change for Pydantic
2:11
Get the Plugins
1:02
Built on Pydantic
4:00
Project Setup
5:11
Our First Pydantic Model
6:20
JSON to Pydantic Converter
5:35
Get the Full Story on Pydantic
0:55
Pydantic has a Solid Foundation
1:18
Foundations: async
29:08
Async introduction
1:24
Async for Speed
4:06
Async for Scalability
1:01
Synchronous Execution Example
4:02
Asynchronous Execution Example
2:21
Skeleton async Program
8:26
Full Concurrency Weather Client
7:48
Beanie Quickstart
48:58
Beanie Quickstart Intro
0:45
Motor, MongoDB's Async Driver
1:48
Beanie Quickstart: Part 1 Classes
12:22
Beanie Quickstart: Part 2 Connections
10:43
Beanie Quickstart: Part 3 Inserts
4:02
Beanie Quickstart: Part 4 Queries
8:43
Beanie Quickstart: part 5 settings
5:28
Lightning Review of Beanie
3:12
Get the Full Story of Beanie
0:40
Bunnet, the Synchronous Beanie
1:15
Modeling with Documents
13:25
Modeling Introduction
0:57
Modeling: Relational vs. Documents
3:27
To Embed or not to Embed?
5:11
What is an Integration Database?
3:11
Looking for More Guidance?
0:39
PyPI Beanie
1:20:36
PyPI Api Introduction
0:47
Recall: Importing the Data
1:03
Review: The Data Model
5:15
Creating the DB Models
8:35
Configuring Collections from Beanie
2:47
Connecting to MongoDB
4:51
CLI Skeleton
4:39
ClI REPL
1:39
Summary Stats
5:29
Recent Packages
5:04
Finding Packages and Releases
10:13
Creating a Release
7:01
Concurrency Safe Create Release
11:03
Creating Users
5:26
Setting the User's Password
6:44
FastAPI Example
52:43
FastAPI Introduction
1:23
FastAPI Skeleton App
6:09
API Endpoints Ready
8:11
Package Details Implementation
12:06
Sometimes API focused models are required
8:35
Stats API
3:36
The Home Page Doesn't Belong in the API Docs
2:01
Static Files: CSS
10:42
Performance Tuning
41:14
Introduction to DB Performance
0:48
Levers and Knobs of MongoDB Performance
4:38
Creating Indexes in the Shell
2:21
Our First Python to MongoDB Index
8:48
Releases Counted in 1ms
6:40
Uniqueness Index for Users
3:48
Projections for Packages
9:08
Concept: Projections in Beanie
1:11
Document Design from a Performance Perspective
3:52
Deployment
54:17
Hosting Introduction
1:14
Don't Do What These Companies Did with MongoDB
2:08
MongoDB as a Service Options
2:04
MongoDB's Security Checklist
2:11
Getting the Server Ready
3:12
Limit Network Access with VPCs and Firewall
5:36
Creating an Encryption Key
1:18
Installing MongoDB
3:44
Configuring MongoDB, Part 1
4:40
Adding Authentication to MongoDB
4:40
Connecting to Production MongoDB with Python
5:43
Importing Data Introduction for Production MongoDB
3:06
Connecting to a Remote MongoDB
6:24
Testing our Python Code in Production
6:26
Final Comments on Speed
1:51
Performance and Load Testing
27:49
Load Testing Introduction
1:07
Introducing Locust
4:20
Consider a Real Server Topology
1:12
Running Locust for Max RPS
10:56
Running Locust for Max Users
9:05
Faster Locust Tests
1:09
Course Conclusion
8:24
Finish Line!
0:42
Git the Source Code, Again
0:30
Final Review
6:11
Stay in Touch
1:01
Buy for $69 + tax Bundle and save 85% Team Gift

Questions? Send us an email: contact@talkpython.fm

Talk Python's Mastodon Michael Kennedy's Mastodon