发布于 2015-09-14 14:58:48 | 158 次阅读 | 评论: 0 | 来源: 网络整理

isdbgrid

This command verifies that a process is a mongos.

If you issue the isdbgrid command when connected to a mongos, the response document includes the isdbgrid field set to 1. 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. The isdbgrid command is not available to mongod. The error document, however, also includes a line that reads "isdbgrid" : 1, just as in the document returned for a 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 isMaster command to determine connection to a mongos. When connected to a mongos, the isMaster command returns a document that contains the string isdbgrid in the msg field.

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务