getParameter

The getParameter command has the following syntax:

  1. {
  2. getParameter: <value>,
  3. <parameter> : <value>
  4. }

The command takes the following fields:

FieldTypeDescriptiongetParameterint, *Specify a value of:

  • * to return all parameters available togetParameters, ignoring the <parameter> field.
  • any numerical value to return the value for the specified<parameter>.<parameter>stringString name of the parameter to retrieve.

The value for <value> does not affect output.

Behavior

getParameter runs on the admin database only, and returnsan error if run on any other database.

The possible value for <parameter> may vary depending on what version andstorage engine in use. See Retrieve All Parameters for anexample of listing the available parameters.

Examples

Retrieve Single Parameter

The following operation runs getParameter on the admindatabase using a value of saslHostName to retrieve the value forthat parameter:

  1. db.adminCommand( { getParameter : 1, "saslHostName" : 1 } )

The command returns the following output:

Note

The output may vary depending on the version and specificconfiguration of your MongoDB instance.

  1. { "saslHostName" : "www.example.net:27018", "ok" : 1 }

Retrieve All Parameters

The following operation runs getParameter with a value of* to retrieve all parameters:

  1. db.adminCommand( { getParameter : '*' } )

Note

The output may vary depending on the version of MongoDB and thespecific configuration of the running MongoDB instance.

See also

setParameter for more about these parameters.