MongoDB for Developers with Python Transcripts
Chapter: Welcome to the course
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. Throughout this course, we're going to learn
0:08 how to connect, model for and build applications with MongoDB, and we're going to do this with Python.
0:15 We're going to look at the straightforward, lowest level way of doing things with PyMongo, and we're going to look at mapping classes
0:21 through what's called an ODM, think orm for Mongo; an ODM to Mongo DB with Mongo Engine. And these come together to make a great combination.
0:32 So let's begin by talking about document databases, how do they work? Well document databases in some ways
0:39 are very much like standard relational databases, they have what you would think of as columns in that relational world,
0:45 title, course id and duration in seconds here for example, but it also has nested data, so in a relational database
0:52 we might have a lectures table that has some kind of foreign key constraint back to a chapter in this example we have on the screen here,
1:00 but in fact in a relational database, we can embed those lectures inside of the chapter object, why is this good?
1:07 Well, often, we spend so much time and energy building up an object hierarchy in our application
1:13 and then tearing that apart into a bunch of little pieces what's called third normal form, basically normalizing our data
1:19 in a relational database and then building a backup, taking it back apart and this object relational impedance mismatch
1:26 makes it hard for us to reason about our code, it makes it a little bit less intuitive and so on. So with document databases, we can model our data
1:35 the same way our application wants to use that data. We also have more flexibility in the schema,
1:40 which means that deploying a new version of our application often does not require some kind of migration script and downtime,
1:48 no, we just deploy the new version and the document database adapts to it. So document databases in my opinion are the best way to build applications,
1:56 for the 80 percent case right, maybe you have some edge case where that doesn't make a lot of sense
2:02 but most apps really benefit from using document databases.