Docs Menu

Docs HomeDevelop ApplicationsMongoDB Manual


On this page

  • Behavior
  • Examples

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>,
comment: <any>

The command takes the following fields:

int, '*'

Specify a value of:

  • '*' to return all parameters available to getParameter, ignoring the <parameter> field.

  • any numerical value to return the value for the specified <parameter>.


String name of the parameter to retrieve.

The value for <value> does not affect output.


Optional. A user-provided comment to attach to this command. Once set, this comment appears alongside records of this command in the following locations:

A comment can be any valid BSON type (string, integer, object, array, etc).

New in version 4.4.

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.

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:


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

{ "saslHostName" : "", "ok" : 1 }

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

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


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.

←  getDefaultRWConcernkillCursors →

On this page