-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathdb.collection.checkMetadataConsistency.txt
94 lines (61 loc) · 2.38 KB
/
db.collection.checkMetadataConsistency.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
========================================
db.collection.checkMetadataConsistency()
========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. method:: db.collection.checkMetadataConsistency(options)
Performs a series of consistency checks on sharding metadata
for the collection. The method returns a cursor with either all or a
batch of the inconsistency results found.
.. |dbcommand| replace:: :dbcommand:`checkMetadataConsistency` command
.. include:: /includes/fact-mongosh-shell-method-alt.rst
Run this method after major maintenance operations, such as upgrades and
downgrades, to check the state of the catalog.
.. include:: /includes/inconsistency-type/index-note
For more information on the inconsistencies this method checks for,
see :ref:`inconsistency-types`.
:returns: This method returns a cursor with a ``documents`` array,
which contains a document for each inconsistency found in
the sharding metadata.
Compatibility
-------------
This method is available in deployments hosted in the following environments:
.. include:: /includes/fact-environments-atlas-only.rst
.. include:: /includes/fact-environments-atlas-support-no-free.rst
.. include:: /includes/fact-environments-onprem-only.rst
.. include:: /includes/method/checkMetadataConsistency-execute-mongos.rst
Syntax
-------
The :method:`db.collection.checkMetadataConsistency` method has the following syntax:
.. code-block:: javascript
db.collection.checkMetadataConsistency( { <options> } )
The ``options`` document can take the following fields and values:
.. include:: /includes/inconsistency-type/checkMetadataConsistency-options.rst
Example
-------
.. io-code-block::
.. input::
:language: javascript
db.authors.checkMetadataConsistency()
.. output::
:language: json
{
cursorHasMore: false,
documents: [
{
type: "MisplacedCollection",
description: "Unsharded collection found on shard different from database primary shard",
details: {
namespace: "test.authors",
shard: "shard02",
localUUID: new UUID("1ad56770-61e2-48e9-83c6-8ecefe73cfc4")
}
}
],
}