Docs 菜单

sh.removeTagRange()

在此页面上

sh.removeTagRange(namespace, minimum, maximum)

注意

此方法的别名为sh.removeRangeFromZone() 。 MongoDB提供区域分片作为标签感知分片的后继方案。

Removes a specified shard tag from a defined range of shard key values. sh.removeTagRange() takes the following arguments:

Parameter
类型
说明

namespace

字符串

要标记的collection的命名空间

minimum

文档

The minimum value of the 片键 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.

maximum

文档

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.

使用 sh.removeTagRange() to ensure that unused or out of date ranges are removed and hence chunks are balanced as required.

仅在连接到mongos实例时运行sh.removeTagRange()

此方法可用于以下环境中托管的部署:

重要

M0、M2、M5 和 Flex 集群不支持此命令。有关更多信息,请参阅不支持的命令。

Given a shard key of {state: 1, zip: 1}, the following operation removes an existing tag range covering zip codes in New York State:

sh.removeTagRange( "exampledb.collection",
{ state: "NY", zip: MinKey },
{ state: "NY", zip: MaxKey }
)

在此页面上