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

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So let's talk about what we're going to cover in this course. We're going to start by getting your machine set up and ready to go.
0:08 It's important that you follow along in this course, that you do the code examples, that you play with the database, that's how we learn as developers.
0:15 So the first thing we are going to do is walk through how to set up your operating system with MongoDB
0:19 and the various other tools that we'll talk about later. Whether you're using MacOS, Windows or Linux,
0:24 we have a video that shows you how to set this up correctly on your machine. Next, we'll dig into what is NoSQL, why do we want to use it,
0:32 what are document databases, I touched a little bit on this in the beginning, but we'll go deep into document databases, how they work,
0:38 and the trade-offs and benefits that we get from them. We'll then start work with MongoDB proper, we're going to fire up MongoDB
0:46 and we're going to connect to it with its native shell and understand its low level native query syntax.
0:51 If this was a relational database, this would be kind of like studying SQL, the TSQL language, but MongoDB doesn't use SQL,
0:59 it uses its own query language which is easily understandable, but it is not the same.
1:04 Now this is actually going to be in Javascript for the most part; you might be thinking this is a Python course, I don't want to learn Javascript.
1:10 Well, for the most part we're going to write our code in Python and we're not going to do anything in Javascript,
1:16 but you need to understand how the query syntax of the various tools and libraries in Python ultimately map down
1:23 to what you could work with in the management tools, and in the management tools it's Javascript in the native query syntax.
1:30 We'll make sure that we cover that really well here as a great foundation. Next up, we're going to talk about modeling data
1:37 with documents rather than tables. You may have heard of third normal form and modeling through normalizing data in a relational database
1:46 and to some degree, that knowledge carries forward into document databases, but there are certainly many other trade-offs
1:53 and different types of modeling scenarios that you want to follow, you certainly don't want to just normalize your document database
2:00 you'd be missing all of the benefits and getting some of the drawbacks potentially. So we'll see that in document databases in general,
2:07 in MongoDB in particular, you model your data a little bit differently
2:11 and have different trade-offs and considerations, and we'll talk about that here. At this point, it's time to start writing the code with Python.
2:17 So we will begin at the primary lowest level that we can work with MongoDB, and this is PyMongo. So here we're going to work in a query language
2:27 that is very, very similar to MongoDB's native Javascript language but we're going to do it from Python, and this works great,
2:35 basically you're exchanging dictionaries and it's very fast and efficient. However, sometimes it makes a lot more sense
2:41 to not just pass loosely typed dictionaries around but rather rich classes with lots of functionality and structure.
2:49 So we're going to also talk about MongoEngine which is an ODM, object document mapper for MongoDB;
2:57 think of this as an ORM, but because there is no relational bit, it's not a relational database, we call it document.
3:03 So ODM for MongoDB and MongoEngine is one of the best ones, it works really well in Python 3 and Python 2,
3:11 it has a whole bunch of features and different things you can add to your application on top of what MongoDB the database itself provides,
3:19 for example like type checking, things like that, so really, really nice and you'll see that MongoEngine
3:24 is a great addition to what you might be doing. Once we get the programming side in place we want to take our database and add tons of data to it,
3:32 so we're going to take a simple example that we were playing with before
3:35 and add something that has effectively millions or at least million records in it and then we're going to start interacting with it from MongoEngine,
3:43 just as well it could have been PyMongo, right, we're going to start interacting with this database with lots of data
3:48 and see that it doesn't perform quite as well as we hoped, maybe as well as all the hype around MongoDB being fast would make you expect.
3:57 So we're going to see that we can take this server and it's kind of ok on its own, if we left it alone
4:02 and we'll make it like five hundred times faster for some totally reasonable operations so we're going to talk about the various knobs and tools
4:09 we have to make MongoDB really fast. They're not hard to do, but they are not automatic so you definitely want to learn about those.
4:16 And finally, we're going to take all of what we've learned and deploy it into a cloud multi server environment
4:23 so we are going to create what would be a fake web app, we'll just have a little Python script that stands in for the web app,
4:29 put that on one server up in a cloud computing environment, on another one, we're going to set up a production hardened MongoDB server
4:36 and we're going to make sure that MongoDB production server is totally locked down, running as safe as possible.
4:43 There are a lot of non obvious things about running MongoDB in production and we want to make sure that it's working really well for us,
4:51 so we're going to go through this section and do five or six different things to get MongoDB ready to be our production database.
4:58 And that's it, this is what we cover the course, I think it's a really comprehensive introduction to MongoDB from Python,
5:05 and I really hope you enjoy it, I really enjoyed creating it for you.


Talk Python's Mastodon Michael Kennedy's Mastodon