Docs Menu
Docs Home
/
MongoDB Manual
/ / /

MisplacedCollection

On this page

  • Description
  • Format
  • Example
MisplacedCollection

Indicates that an unsharded collection exists on the incorrect shard and was not moved with moveCollection.

New in version 7.0.

Changed in version 8.0.

{
type: "MisplacedCollection",
description: "<string>",
details: {
namespace: "<string>",
shard: "<string>",
localUUID: UUID("<uuid>")
}
}

MisplacedCollection inconsistency documents contain the following fields:

Field
Type
Description
type
string

Type of inconsistency document. Returns a value of MisplacedCollection 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.shard
string

The shard where the inconsistency exists.

details.localUUID
UUID
The local UUID of the misplaced collection.

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

{
cursor: {
id: Long("0"),
ns: "test.$cmd.aggregate",
firstBatch: [
{
type: "MisplacedCollection",
description: "Found unsharded collection without the appropriate metadata on a shard different from the database primary shard",
details: {
namespace: "test.authors",
shard: "shard02",
localUUID: new UUID("1ad56770-61e2-48e9-83c6-8ecefe73cfc4")
}
}
],
},
ok: 1
}

Back

InconsistentIndex