对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。
See how MongoDB 9.0 delivers up to 2x higher throughput.
MongoDB Branding Shape
Register now >
Docs 菜单

IncompatibleUniqueIndexOnShardedCollection

IncompatibleUniqueIndexOnShardedCollection

分集合分片的的索引具有与唯一性要求不兼容的索引选项。

8.3版本新增。

{
type: "IncompatibleUniqueIndexOnShardedCollection",
description: "<string>",
details: {
namespace: "<string>",
info: <document>
}
}

ZonesRangeOverlap 不一致文档包含以下字段:

字段
类型
说明

type

字符串

不一致文档的类型。 为此不一致类型返回值IncompatibleUniqueIndexOnShardedCollection 。

description

字符串

描述在元数据中发现的不一致之处。

details

文档

包含有关数据库和分片集群中哪些位置存在不一致的附加信息的文档。

details.namespace

字符串

指示存在不一致的数据库和collection。

details.info

文档

有关不兼容的唯一索引的信息。

使用 db.adminCommand() 方法调用 checkMetadataConsistency 命令,并将 checkIndexes 标志设立为 1:

db.adminCommand( {
checkMetadataConsistency: 1,
checkIndexes: 1
} )

该方法返回一个游标,其中包含一批文档,显示分片元数据中发现的不一致。 以下示例显示了带有ZonesRangeOverlap不一致文档的游标:

{
cursor: {
id: Long("0"),
ns: "test.$cmd.aggregate",
firstBatch: [
{
type: "IncompatibleUniqueIndexOnShardedCollection",
description: "Found incompatible index options with uniqueness in a sharded collection",
details: {
namespace: "test.authors",
info: {
index: { v: 2, unique: true, key: { author: 1 }, name: "author_1" },
shard: "test-rs1",
issue: "Collation must be simple and the shard key must be a prefix of the index key if the index is unique in a sharded collection",
shardKey: { author: 1 }
}
}
}
],
},
ok: 1
}
给本页内容打分

在此页面上