Docs Menu
Docs Home
/
MongoDB Manual
/ / /

InconsistentIndex

On this page

  • Description
  • Format
  • Example
InconsistentIndex

An index exists on two different shards that contains differing metadata or a specific index is missing on some shards.

New in version 7.0.

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

InconsistentIndex inconsistency documents contain the following fields:

Field
Type
Description
type
string

Type of inconsistency document. Returns a value of InconsistentIndex for this inconsistency type.

description
string

Describes the inconsistency found in the metadata.

details
document

Document with additional information on where the inconsistency exists in the database and sharded cluster.

details.namespace
string

Indicates the database and collection where the inconsistency exists.

details.info
document
Information on the inconsistent index.

Use the db.adminCommand() method to call the checkMetadataConsistency command:

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

The method returns a cursor with a batch of documents showing the inconsistencies found in the sharding metadata. The example below shows a cursor with a InconsistentIndex inconsistency document:

{
cursor: {
id: Long("0"),
ns: "test.$cmd.aggregate",
firstBatch: [
{
type: "InconsistentIndex",
description: "Found an index of a sharded collection that is inconsistent between different shards",
details: {
namespace: "test.authors",
info: {
missingFromShards: [
"shard-rs1"
],
inconsistentProperties: [ ],
indexName: "index1"
}
}
}
],
},
ok: 1
}

Back

HiddenShardedCollection