MongoDB for Developers with Python Transcripts
Chapter: Welcome to the course
Lecture: Welcome!

Login or purchase this course to watch this video and the rest of the course contents.
0:01 Hello and welcome to MongoDB for Python developers.
0:04 Throughout this course, we're going to learn
0:07 how to connect, model for and build applications with MongoDB,
0:11 and we're going to do this with Python.
0:14 We're going to look at the straightforward, lowest level way of doing things
0:17 with PyMongo, and we're going to look at mapping classes
0:20 through what's called an ODM, think orm for Mongo;
0:24 an ODM to Mongo DB with Mongo Engine.
0:28 And these come together to make a great combination.
0:31 So let's begin by talking about document databases, how do they work?
0:35 Well document databases in some ways
0:38 are very much like standard relational databases,
0:40 they have what you would think of as columns in that relational world,
0:44 title, course id and duration in seconds here for example,
0:48 but it also has nested data, so in a relational database
0:51 we might have a lectures table that has
0:54 some kind of foreign key constraint back to a chapter
0:56 in this example we have on the screen here,
0:59 but in fact in a relational database, we can embed those lectures
1:02 inside of the chapter object, why is this good?
1:06 Well, often, we spend so much time and energy
1:09 building up an object hierarchy in our application
1:12 and then tearing that apart into a bunch of little pieces
1:15 what's called third normal form, basically normalizing our data
1:18 in a relational database and then building a backup, taking it back apart
1:22 and this object relational impedance mismatch
1:25 makes it hard for us to reason about our code,
1:28 it makes it a little bit less intuitive and so on.
1:31 So with document databases, we can model our data
1:34 the same way our application wants to use that data.
1:37 We also have more flexibility in the schema,
1:39 which means that deploying a new version of our application
1:43 often does not require some kind of migration script and downtime,
1:47 no, we just deploy the new version and the document database adapts to it.
1:51 So document databases in my opinion are the best way to build applications,
1:55 for the 80 percent case right, maybe you have some edge case
1:58 where that doesn't make a lot of sense
2:01 but most apps really benefit from using document databases.