Community Day Trivia #21: What schema design pattern solves the problem of large documents with data that isn't used frequently?

We’ll be posting trivia challenges throughout the Community Day event!

The best answer for each challenge will be marked as a solution and earn the poster a promo code for $100 of Atlas credits and a Community Day 2021 Trivia Winner forum badge that can also be used as a title on the forums.

A great answer will include some information such as a link to more information or a tip on how you figured out the solution.

You can help us decide the best answer to a trivia challenge by liking great responses! To give everyone a chance at earning Atlas credits, we will use “have you already had a trivia solution accepted” to break ties in favour of those who haven’t had a solution yet.

What schema design pattern solves the problem of large documents with data that isn’t used frequently?

The Subset Pattern would solve this problem - Building with Patterns: The Subset Pattern | MongoDB Blog

Here’s the list of all the patterns - Building with Patterns: A Summary | MongoDB Blog

Kudos to Daniel and Ken for the excellent blog series!



Excellent answer @mahisatya!

I’ll be following up with a $100 Atlas promo code :slight_smile:


1 Like

Hi I’d go for an extended reference pattern since:

  • the large docs can be separated in a different collection
  • the data is not frequently used two reads or even a $lookup (if really needed) will not harm

The subset patter would match more when parts (sub sets) of the large docs are frequently used. You separate the most (and more often) used data from the large doc and keep this in a frequently used collection.


Hi @Michael,

Great perspective and potentially a more appropriate pattern depending on the data relationships (which weren’t specified for this trivia challenge). I did angle this trivia question towards how we describe the Subset pattern, but I also tried to fit everything into the topic title :slight_smile: .

I liked that @mahisatya recommended a pattern that might solve this problem but also linked to the full roster of patterns for more ideas. Choosing the most effective schema design for MongoDB depends on how data is used rather than how data is stored, so in a real world use case more discussion would be needed.


1 Like