Building Data-Driven Web Apps with Pyramid 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 make this a full MongoDB course, but I want to give you just enough of a foundation of how these things work
0:07
so you can sort of appreciate what we're doing. So the way we model data in document databases is very different than relational databases.
0:14
Relational databases, we have, say, packages and we have users and we have a maintainer's table which is a normalization table between them
0:22
things like that. In document databases, it's much closer to actually being the same shape and style as you have in memory, hierarchical
0:30
as you do in the database. So, for example, here is a chapter from one of my courses in MongoDB. The green stuff here is the same as you would have
0:40
in SQLte, Postgres, whatever, right? It's just straight columns. But notice those lectures. These are, that's an array in JavaScript
0:48
and then that's an embedded series of objects. So these are embedded in here, and you can think of this as like a pre-computed join
0:55
one of the reasons these databases can be so fast. So the big question is can you actually query deeply down into here?
1:01
Can you still answer the question? What chapter has lecture 10106 and could I get it back? Luckily, you can, and you can do that with an index
1:10
and can be incredibly fast. So we're going to ask and answer questions like that throughout this chapter.