- Reference >
mongoShell Methods >- Sharding Methods >
- sh.removeTagRange()
sh.removeTagRange()¶
On this page
Definition¶
-
sh.removeTagRange(namespace, minimum, maximum, tag)¶ Changed in version 3.4: This method aliases to
sh.removeRangeFromZone()in MongoDB 3.4. The functionality specified below still applies to MongoDB 3.2. MongoDB 3.4 provides Zone sharding as the successor to tag-aware sharding.New in version 3.0.
Removes a range of shard key values to a shard tag created using the
sh.addShardTag()method.sh.removeTagRange()takes the following arguments:Parameter Type Description namespacestring The namespace of the sharded collection to tag. minimumdocument The minimum value of the shard key from the tag. Specify the minimum value in the form of <fieldname>:<value>. This value must be of the same BSON type or types as the shard key.maximumdocument The maximum value of the shard key range from the tag. Specify the maximum value in the form of <fieldname>:<value>. This value must be of the same BSON type or types as the shard key.tagstring The name of the tag attached to the range specified by the minimumandmaximumarguments to.Use
sh.removeShardTag()to ensure that unused or out of date ranges are removed and hence chunks are balanced as required.Only issue
sh.removeTagRange()when connected to amongosinstance.
Example¶
Given a shard key of {state: 1, zip: 1}, the following operation
removes an existing tag range covering zip codes in New York State: