From the course: Data Modeling in MongoDB

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

One-to-many relationships with embedded documents

One-to-many relationships with embedded documents - MongoDB Tutorial

From the course: Data Modeling in MongoDB

One-to-many relationships with embedded documents

- [Instructor] We know that complex relationships are a reality when modeling data for a large application. In this lesson, we'll go beyond simple one-to-one connections and look into a more common use case, one-to-many relationships. We've been highly focused to this point on modeling out a single post, but we really need to consider a full social media page as an array of posts. But what are our use case for delivering a list of posts to the application? Our application has two main use cases to consider. First, all posts written by a given user, for example, your homepage. And second, all posts a given user should see, for example, your feed, which has the most recent post from all the people you know. This is going to require that we zoom out a little bit more and make some decisions on how best to retrieve this information. Again, think about your process. When modeling for Mongo, we should be working…

Contents