Skip to main content

MongoDB Fundamentals with Python

Introduction to MongoDB

0:00
LearnStep 1/2

What is MongoDB?

Introduction to MongoDB

MongoDB is a document-oriented NoSQL database designed for scalability and flexibility.

Document Database Concepts

SQL TermMongoDB Term
DatabaseDatabase
TableCollection
RowDocument
ColumnField
JOINEmbedded documents / $lookup
Primary Key_id field

MongoDB Document Example

json

When to Use MongoDB

  • Flexible schema: Documents can have varying structures
  • Embedded data: Related data stored together
  • Horizontal scaling: Built-in sharding
  • High write throughput: Optimized for writes
  • Geospatial data: Native geospatial support
  • Real-time analytics: Aggregation pipeline

MongoDB Architecture

Python Libraries for MongoDB

LibraryUse Case
PyMongoSynchronous MongoDB driver
MotorAsync MongoDB driver (asyncio/Tornado)
MongoEngineODM (Object-Document Mapper)
BeanieAsync ODM with Pydantic