DBAtlas · Database operations atlas

Add a zone (tag) and assign a range

MongoDBSharding

Command

sh.addShardToZone("shard0000", "TR"); sh.updateZoneKeyRange("shop.customer", { region: "TR" }, { region: "TR~" }, "TR")

What it does

Assigns a shard to a zone and binds a specific key range to that zone (zone sharding).

When to use it

When you want to keep data on specific shards by geography or hardware.

Caution

Zone ranges must match the shard key; a wrong range prevents chunks from being migrated.

Open in DBAtlas →

Related