ANNOUNCEMENT: Voyage AI joins MongoDB to power more accurate and trustworthy AI applications on Atlas.
Learn more
Menu Docs

isdbgrade

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.

Esse comando está disponível em implantações hospedadas nos seguintes ambientes:

  • MongoDB Atlas: o serviço totalmente gerenciado para implantações do MongoDB na nuvem

Observação

Este comando é aceito em todos os clusters do MongoDB Atlas. Para obter informações sobre o suporte do Atlas a todos os comandos, consulte Comandos não suportados.

  • MongoDB Enterprise: a versão autogerenciada e baseada em assinatura do MongoDB

  • MongoDB Community: uma versão com código disponível, de uso gratuito e autogerenciada do MongoDB

O comando tem a seguinte sintaxe:

db.runCommand(
{
isdbgrid: 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 hello command to determine connection to a mongos. When connected to a mongos, the hello command returns a document that contains the string isdbgrid in the msg field.