Introduction to MongoDB in Python
Filip Schouwenaars
Machine Learning Researcher

| student_id | name | course_code | title |
|---|---|---|---|
| 1 | Amina | CS101 | Intro to Coding |
| 1 | Amina | MATH201 | Algebra Basics |
| 2 | Luca | CS101 | Intro to Coding |
Students
| student_id | name |
|---|---|
| 1 | Amina |
| 2 | Luca |
Students
| student_id | name |
|---|---|
| 1 | Amina |
| 2 | Luca |
Courses
| course_code | title |
|---|---|
| CS101 | Intro to Coding |
| MATH201 | Algebra Basics |
Students
| student_id | name |
|---|---|
| 1 | Amina |
| 2 | Luca |
Enrollments
| student_id | course_code |
|---|---|
| 1 | CS101 |
| 1 | MATH201 |
| 2 | CS101 |
Courses
| course_code | title |
|---|---|
| CS101 | Intro to Coding |
| MATH201 | Algebra Basics |
Relational model



from pymongo import MongoClient# Create client (localhost) client = MongoClient()# Create client (remote server) client2 = MongoClient("mongodb+srv://usr:[email protected]")
Introduction to MongoDB in Python