isdbgrid

isdbgrid

This command verifies that a process is a mongos.此命令验证进程是否为mongos

If you issue the isdbgrid command when connected to a mongos, the response document includes the isdbgrid field set to 1. 如果您在连接到mongos时发出isdbgrid命令,则响应文档包含设置为1isdbgrid字段。The returned document is similar to the following:返回的文档类似于以下内容:

{ "isdbgrid" : 1, "hostname" : "app.example.net", "ok" : 1 }

If you issue the isdbgrid command when connected to a mongod, MongoDB returns an error document. 如果在连接到mongod时发出isdbgrid命令,MongoDB将返回一个错误文档。The isdbgrid command is not available to mongod. isdbgrid命令对mongod不可用。The error document, however, also includes a line that reads "isdbgrid" : 1, just as in the document returned for a mongos. 然而,错误文档中还包含一行"isdbgrid" : 1,就像为mongos返回的文档中一样。The error document is similar to the following:错误文档类似于以下内容:

{
   "errmsg" : "no such cmd: isdbgrid",
   "bad cmd" : {
         "isdbgrid" : 1
   },
   "ok" : 0
}

You can instead use the hello command to determine connection to a mongos. 相反,您可以使用hello命令来确定与mongo的连接。When connected to a mongos, the hello command returns a document that contains the string isdbgrid in the msg field.当连接到mongos时,hello命令返回一个文档,该文档在msg字段中包含字符串isdbgrid

←  getShardVersionlistShards →