Building data-driven web apps with Pyramid and SQLAlchemy Transcripts
Chapter: MongoDB edition
Lecture: How document databases work
0:00 I did say that we're not going to make this
0:01 a full MongoDB course, but I want to give you just enough
0:04 of a foundation 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 In document databases, it's much closer
0:24 to actually being the same shape and style
0:27 as you have in memory, hierarchical
0:29 as you do in the database.
0:30 So, for example, here is a chapter
0:32 from one of my courses in MongoDB.
0:36 The green stuff here is the same as you would have
0:39 in SQLte, Postgres, whatever, right?
0:42 It's just straight columns.
0:44 But notice those lectures.
0:47 and then that's an embedded series of objects.
0:50 So these are embedded in here, and you can think of this
0:52 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
0:58 can you actually query deeply down into here?
1:00 Can you still answer the question?
1:02 What chapter has 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 can be incredibly fast.
1:11 So we're going to ask and answer questions like that
1:13 throughout this chapter.