Building Data-Driven Web Apps with Flask and SQLAlchemy Transcripts
Chapter: MongoDB edition
Lecture: How document databases work

Login or purchase this course to watch this video and the rest of the course contents.
0:00 I did say that we're not going to
0:01 make this a full MongoDB course
0:02 but I want to give you just enough of a foundation
0:05 of how these things work
0:06 so you can sort of appreciate what we're doing.
0:09 So the way we model data in document databases
0:11 is very different than relational databases.
0:13 Relational databases we have, say, packages
0:16 and we have users and we have a maintainer's table
0:19 which is a normalization table between them
0:21 things like that.
0:22 And document databases, it's much closer to actually
0:25 being the same shape and style as you have
0:27 in memory, hierarchical, as you do in the database.
0:30 So for example, here is a chapter from one
0:33 of my courses in MongoDB.
0:36 The green stuff here is the same as you would have
0:39 in SQLite, Postgres, whatever, right?
0:42 It's just straight comlumns but notice those lectures.
0:45 These are, it's an array, in JavaScript
0:47 and then that's an embedded series of objects.
0:50 So these are embedded in here
0:51 and you can think of this as like a pre-computed join
0:54 one of the reasons these databases can be so fast.
0:57 So the big question is, Can you actually query deeply
0:59 down into here?
1:00 Can you still answer the question, What chapter has
1:03 Lecture 10106?
1:06 And could I get it back?
1:07 Luckily you can, and you can do that with an index
1:09 and it can be incredibly fast.
1:11 So we're going to ask and answer questions like that
1:13 throughout this chapter.