对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。
Docs 菜单

sh.removeTagRange()(mongosh方法)

sh.removeTagRange(namespace, minimum, maximum)

注意

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

从定义的分片键值范围中删除指定的分片标签。 sh.removeTagRange()接受以下参数:

Parameter
类型
说明

namespace

字符串

要标记的collection的命名空间。

minimum

文档

标签中分片键的最小值。 以<fieldname>:<value>的形式指定最小值。 此值必须与分片键属于相同的 BSON 类型。

maximum

文档

The maximum value of the shard key range from the tag. 以<fieldname>:<value>的形式指定最大值。 此值必须与分片键属于相同的 BSON 类型。

使用sh.removeTagRange()可确保删除未使用或过时的范围,从而根据需要平衡数据块。

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

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

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud

重要

This command is not supported in M0 and Flex clusters. For more information, see Unsupported Commands.

给定分片键{state: 1, zip: 1} ,以下操作删除涵盖纽约州邮政编码的现有标签范围:

sh.removeTagRange( "exampledb.collection",
{ state: "NY", zip: MinKey },
{ state: "NY", zip: MaxKey }
)
给本页内容打分

在此页面上