Docs Menu
Docs Home
/
MongoDB Manual
/ / /

TrackedUnshardedCollectionHasInvalidKey

On this page

  • Description
  • Format
  • Example
TrackedUnshardedCollectionHasInvalidKey

An unsharded collection has an invalid shard key.

New in version 8.0.

{
type: "TrackedUnshardedCollectionHasInvalidKey",
description: "<string>",
details: {
namespace: "<string>",
uuid: UUID("<uuid>"),
shardKey: <document>
}
}

TrackedUnshardedCollectionHasInvalidKey inconsistency documents contain these fields:

Field
Type
Description
type
string

Type of inconsistency document. Returns a value of TrackedUnshardedCollectionHasInvalidKey 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.uuid
UUID

UUID of the collection registered on the sharding catalog.

details.shardKey
document

Collection shard key pattern.

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 TrackedUnshardedCollectionHasInvalidKey inconsistency document:

{
cursor: {
id: Long("0"),
ns: "test.$cmd.aggregate",
firstBatch: [
{
type: "TrackedUnshardedCollectionHasInvalidKey",
description: "Found tracked unsharded collection with invalid shard-key",
details: {
namespace: "test.authors",
uuid: UUID("ebfba414-b576-4f77-bb0e-0d56f3a53c55"),
shardKey: { "name": 1 }
}
}
],
},
ok: 1
}

Back

ShardThinksCollectionIsUnsharded