This article presents a possible use case and corresponding sample flow that you can support. This can be a helpful starting point as you plan your implementation.
You can improve the performance of queries on a large tutorials collection by creating indexes for commonly filtered and sorted fields. This ensures that user-facing queries (such as filtering by category and sorting by publish date) return results quickly, even as the collection grows to hundreds of tutorials.
To create indexes for tutorials in a collection:
Call Create Index. Specify values for name, fields.path, and fields.order.
For example, to optimize queries by category in alphabetical order and most recent date published, you might specify an index as follows:
Call Create Index again to create a unique index on slug to enforce unique tutorial URL slugs and accelerate slug lookups. Specify values for name and fields.path. To prevent duplicate slug values in the collection, set the value of unique to true.
For example, to optimize queries for tutorials by category in alphabetical order and most recent date published, you might specify an index as follows:
To monitor index creation status:
Call List Indexes to retrieve all indexes for the collection.
Check each index's status field. When status is ACTIVE, the index is ready to use. While status is BUILDING, index creation is still in progress.