Navigation
This version of the documentation is archived and no longer supported.

getParameter

On this page

getParameter

getParameter is an administrative command for retrieving the values of parameters. Use the db.adminCommand( { command } ) method to run the getParameter command in the admin database.

The getParameter command has the following syntax:

{
   getParameter: <value>,
   <parameter> : <value>
}

The command takes the following fields:

Field Type Description
getParameter int, string, document

Specify a value of:

  • 1 (or any integer value) to return the value for the specified <parameter>.
  • '*' to return values for all parameters available to getParameter, ignoring the <parameter> field.
  • { showDetails: true } to return a document containing:
    • value, the value that <parameter> is set to
    • settableAtRuntime, whether or not <parameter> can be set at runtime
    • settableAtStartup, whether or not <parameter> can be set at startup
  • { showDetails: true, allParameters: true } to return a document containing showDetails fields for all parameters.
<parameter> string

String name of the parameter to retrieve.

The value for <value> does not affect output.

Behavior

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

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

Examples

Retrieve Single Parameter

The following operation runs getParameter on the admin database using a value of saslHostName to retrieve the value for that parameter:

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

The command returns the following output:

Note

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

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

Retrieve All Parameters

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

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

Note

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

See also

setParameter for more about these parameters.

Report Details on a Single Parameter

The following example runs getParameter with {showDetails: true} to report details on saslHostName.

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

Example output:

{
  saslHostName: {
    value: '<hostname>',
    settableAtRuntime: false,
    settableAtStartup: true
  },
  ok: 1
}

Note

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

Report Details for All Parameters

The following example runs getParameter with {showDetails: true, allParameters: true} to report details on all parameters.

db.adminCommand( { getParameter : { showDetails: true, allParameters: true } } )
←   fsyncUnlock killCursors  →