Numan Hanif
Numan Hanif

Reputation: 246

Mongodb Range Based sharding

I would like to shard my collection on the basis of range on mongodb shards, my question is if shard key is string field then how will we divide string based shard key in different chunks for range based sharding ???

Upvotes: 5

Views: 863

Answers (1)

SDillon
SDillon

Reputation: 313

You can divide a string across shards using tag aware sharding. You create the "tags" denoting the ranges of the key to assign to a specific shard. Mongo's balancer will handle the distribution of the data and when you write a query for the key in question Mongo will know to target only that shard.

For more information see the following URL from the vendor. sharding-introduction/

Upvotes: 1

Related Questions