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:
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:
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.