Collection Sharding Strategy
Collection Sharding Strategy
Sharding strategy where data is divided into multiple collections in a single database identified by a shardHint (usually a suffix to the collection name). The read & write queries made to the database resolves the collection to route the query to based on the Sharding hint set in the context. The schema across all the different shards in a database is same.
In the above example, the base name of the collection is TEST
with the valid shard hints being 0, 1 and 2. Any read or write query made to the database routes the query to the right collection based on the hint set in the context.
Last updated