MissingShardKeyIndex
On this page
Description
Format
{ type: "MissingShardKeyIndex", description: "<string>", details: { namespace: "<string>", shard: "<string>", shardKey: { <document> } } }
MissingShardKeyIndex
inconsistency documents contain the following fields:
Field | Type | Description |
---|---|---|
| string | Type of inconsistency document. Returns a value of |
| string | Describes the inconsistency found in the metadata. |
| document | Document with additional information on where the inconsistency exists in the database and sharded cluster. |
| string | Indicates the database and collection where the inconsistency exists. |
| string | The shard where the inconsistency exists. |
| document | The shard key that requires an index. |
Example
Use the db.adminCommand()
method to call the
checkMetadataConsistency
command:
db.adminCommand( { checkMetadataConsistency: 1 } )
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 MissingShardKeyIndex
inconsistency document:
{ cursor: { id: Long("0"), ns: "test.$cmd.aggregate", firstBatch: [ { type: "MissingShardKeyIndex", description: "Found sharded collection without a shard key index", details: { namespace: "test.authors", shard: "shard-rs0", shardKey: { skey: 1 } } } ], }, ok: 1 }