Group Data
This version of the documentation is archived and no longer supported. View the current documentation to learn how to upgrade your version of MongoDB server.
If your schema contains a large series of data, grouping that data into multiple smaller series can improve performance.
Your schema may also need to handle outliers in a series that cause poor performance for more common data values. To improve performance and organization for groups of data, you can use the bucket and outlier patterns.
Use Cases
Scenario | Design Pattern Application |
---|---|
Your database stores a large array of product reviews, and your
application paginates reviews in groups of 10. | Use the bucket pattern to group product reviews and handle
pagination on the server. This approach reduces the application
workload and simplifies pagination logic. |
Your database stores reviews for books. A new, popular book
receives many more reviews than other books in the collection. | Use the outlier pattern to separate the popular book's
reviews into separate documents. With this approach, you do not
have one large document that disrupts data retrieval for smaller,
more typical sized documents. |
Tip
Time series collections apply the bucket pattern automatically, and are suitable for most use cases of the bucket pattern.
Get Started
To learn how to apply design patterns to group data, see these pages: