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 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. And document databases, it's much closer to actually being the same shape and style as you have
0:28
in memory, hierarchical, as you do in the database. So for example, here is a chapter from one of my courses in MongoDB.
0:37
The green stuff here is the same as you would have in SQLite, Postgres, whatever, right? It's just straight comlumns but notice those lectures.
0:46
These are, it's an array, in JavaScript and then that's an embedded series of objects. So these are embedded in here
0:52
and you can think of this as like a pre-computed join one of the reasons these databases can be so fast.
0:58
So the big question is, Can you actually query deeply down into here? Can you still answer the question, What chapter has Lecture 10106?
1:07
And could I get it back? Luckily you can, and you can do that with an index and it can be incredibly fast.
1:12
So we're going to ask and answer questions like that throughout this chapter.