From the course: Data Modeling in MongoDB

Unlock the full course today

Join today to access over 25,200 courses taught by industry experts.

Embedded documents as subdocuments

Embedded documents as subdocuments - MongoDB Tutorial

From the course: Data Modeling in MongoDB

Embedded documents as subdocuments

- [Instructor] In this lesson, we'll be taking a look into subdocuments or embedded data. Now to this point, we've been talking a lot about our documents being expressive or having depth to them. That depth comes to us sometimes just as a matter of how we describe things, but often, those things have semantics about them or some predictable structure. And this is where we get into defining the smaller parts of our models with subdocument modeling. Before we dig in, let's remind ourselves again of the target that we're diving into, which is a single post. Now the post has a user. It's got the post itself, along with the list of all the reactions, a summary about the users that reacted to it, and a visible reply labeled the most relevant content. Let's dig in a little deeper and see if we can find patterns within a post. Looking deeper at a post, we can see that we have two users being shown on screen. Likely, if there…

Contents