Docs Menu
Docs Home
/
MongoDB Manual
/ /

Group Data

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.

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.

To learn how to apply design patterns to group data, see these pages:

Back

Approximation Pattern