Python 中的 MongoDB 入門
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 |
關聯式模型



from pymongo import MongoClient# 建立用戶端(localhost) client = MongoClient()# 建立用戶端(遠端伺服器) client2 = MongoClient("mongodb+srv://usr:[email protected]")
Python 中的 MongoDB 入門