sh.removeTagRange()
On this page本页内容
Definition定义
sh.removeTagRange(namespace, minimum, maximum, tag)
Changed in version 3.4.3.4版更改。This method aliases to此方法别名为MongoDB 3.4中的sh.removeRangeFromZone()
in MongoDB 3.4.sh.removeRangeFromZone()
。The functionality specified below still applies to MongoDB 3.2. MongoDB 3.4 provides Zone sharding as the successor to tag-aware sharding.下面指定的功能仍然适用于MongoDB 3.2。MongoDB 3.4提供了区域分片作为标记感知分片的继承。Removes a specified shard tag from a defined range of shard key values.从定义的分片键值范围中删除指定的分片标记。sh.removeTagRange()
takes the following arguments:采用以下参数:Parameter参数Type类型Description描述namespace
string The namespace of the sharded collection to tag.要标记的分片集合的命名空间。minimum
document The minimum value of the shard key from the tag.标记中分片键的最小值。Specify the minimum value in the form of以<fieldname>:<value>
.<fieldname>:<value>
的形式指定最小值。This value must be of the same BSON type or types as the shard key.该值必须与分片键具有相同的BSON类型。maximum
document The maximum value of the shard key range from the tag.从标记开始的分片关键帧范围的最大值。Specify the maximum value in the form of以<fieldname>:<value>
.<fieldname>:<value>
的形式指定最大值。This value must be of the same BSON type or types as the shard key.该值必须与分片键具有相同的BSON类型。tag
string The name of the tag attached to the range specified by the附加到的minimum
andmaximum
arguments to.minimum
和maximum
参数指定的范围的标记的名称。Use使用sh.removeShardTag()
to ensure that unused or out of date ranges are removed and hence chunks are balanced as required.sh.removeShardTag()
确保删除未使用或过期的范围,从而根据需要平衡块。Only issue仅在连接到sh.removeTagRange()
when connected to amongos
instance.mongos
实例时发出sh.removeTagRange()
。
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:{state: 1, zip: 1}
的分片键,以下操作将删除覆盖纽约州邮政编码的现有标记范围:
sh.removeTagRange( "exampledb.collection",
{ state: "NY", zip: MinKey },
{ state: "NY", zip: MaxKey },
"NY"
)