/
isdbgrid.txt
46 lines (35 loc) · 1.39 KB
/
isdbgrid.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
========
isdbgrid
========
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
.. dbcommand:: isdbgrid
This command verifies that a process is a :binary:`~bin.mongos`.
If you issue the :dbcommand:`isdbgrid` command when connected to a
:binary:`~bin.mongos`, the response document includes the ``isdbgrid``
field set to ``1``. The returned document is similar to the
following:
.. code-block:: javascript
{ "isdbgrid" : 1, "hostname" : "app.example.net", "ok" : 1 }
If you issue the :dbcommand:`isdbgrid` command when connected to a
:binary:`~bin.mongod`, MongoDB returns an error document. The
:dbcommand:`isdbgrid` command is not available to :binary:`~bin.mongod`.
The error document, however, also includes a line that reads
``"isdbgrid" : 1``, just as in the document returned for a
:binary:`~bin.mongos`. The error document is similar to the following:
.. code-block:: javascript
{
"errmsg" : "no such cmd: isdbgrid",
"bad cmd" : {
"isdbgrid" : 1
},
"ok" : 0
}
You can instead use the :dbcommand:`isMaster` command to determine
connection to a :binary:`~bin.mongos`. When connected to a
:binary:`~bin.mongos`, the :dbcommand:`isMaster` command returns a document that
contains the string ``isdbgrid`` in the ``msg`` field.