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