> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

# getParameter (database command)

## Definition

[`getParameter`](https://www.mongodb.com/docs/manual/reference/command/getParameter.md#mongodb-dbcommand-dbcmd.getParameter) is an administrative command for retrieving the values of parameters. Use the [`db.adminCommand( { command } )`](https://www.mongodb.com/docs/manual/reference/method/db.adminCommand.md#mongodb-method-db.adminCommand) method to run the [`getParameter`](https://www.mongodb.com/docs/manual/reference/command/getParameter.md#mongodb-dbcommand-dbcmd.getParameter) command in the `admin` database.

## Compatibility

This command is available in deployments hosted in the following environments:

- [MongoDB Atlas](https://www.mongodb.com/docs/atlas): The fully managed service for MongoDB deployments in the cloud

**Important:**

This command has limited support in M0 and Flex clusters. For more information, see [Unsupported Commands.](https://www.mongodb.com/docs/atlas/unsupported-commands/)

- [MongoDB Enterprise](https://www.mongodb.com/docs/manual/administration/install-enterprise.md#std-label-install-mdb-enterprise): The subscription-based, self-managed version of MongoDB

- [MongoDB Community](https://www.mongodb.com/docs/manual/administration/install-community.md#std-label-install-mdb-community-edition): The source-available, free-to-use, and self-managed version of MongoDB

## Syntax

The command has the following syntax:

```javascript
db.adminCommand(
   {
     getParameter: <value>,
     <parameter> : <value>,
     comment: <any>
   }
)
```

## Command Fields

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`](https://www.mongodb.com/docs/manual/reference/command/getParameter.md#mongodb-dbcommand-dbcmd.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](https://www.mongodb.com/docs/manual/reference/command/getParameter.md#std-label-showdetails-fields) for **all** parameters.; `{ allParameters: true }` to return a document containing **all** parameters.`{ allParameters: true, setAt: "startup" }` to return a document containing all parameters that you can set at startup.**New in version 8.0**; `{ allParameters: true, setAt: "runtime" }` to return a document containing all parameters that you can set at runtime.**New in version 8.0** |
| `<parameter>` | string | String name of the parameter to retrieve. The value for `<value>` does not affect output. |
| `comment` | any | Optional. A user-provided comment to attach to this command. Once set, this comment appears alongside records of this command in the following locations: [mongod log messages](https://www.mongodb.com/docs/manual/reference/log-messages.md#std-label-log-messages-ref), in the `attr.command.cursor.comment` field.; [Database profiler](https://www.mongodb.com/docs/manual/reference/database-profiler.md#std-label-profiler) output, in the [`command.comment`](https://www.mongodb.com/docs/manual/reference/database-profiler.md#mongodb-data-system.profile.command) field.; [`currentOp`](https://www.mongodb.com/docs/manual/reference/command/currentOp.md#mongodb-dbcommand-dbcmd.currentOp) output, in the [`command.comment`](https://www.mongodb.com/docs/manual/reference/command/currentOp.md#mongodb-data-currentOp.command) field. A comment can be any valid [BSON type](https://www.mongodb.com/docs/manual/reference/bson-types.md#std-label-bson-types) (string, integer, object, array, etc). |

## Behavior

[`getParameter`](https://www.mongodb.com/docs/manual/reference/command/getParameter.md#mongodb-dbcommand-dbcmd.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](https://www.mongodb.com/docs/manual/reference/command/getParameter.md#std-label-getParameter-retrieve-all-params) for an example of listing the available parameters.

## Examples

### Retrieve Single Parameter

The following operation runs [`getParameter`](https://www.mongodb.com/docs/manual/reference/command/getParameter.md#mongodb-dbcommand-dbcmd.getParameter) on the `admin` database using a value of `saslHostName` to retrieve the value for that parameter:

```javascript
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.

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

### Retrieve All Parameters

The following operation runs [`getParameter`](https://www.mongodb.com/docs/manual/reference/command/getParameter.md#mongodb-dbcommand-dbcmd.getParameter) with a value of `'*'` to retrieve all parameters:

```javascript
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`](https://www.mongodb.com/docs/manual/reference/command/setParameter.md#mongodb-dbcommand-dbcmd.setParameter) for more about these parameters.

### Report Details on a Single Parameter

The following example runs [`getParameter`](https://www.mongodb.com/docs/manual/reference/command/getParameter.md#mongodb-dbcommand-dbcmd.getParameter) with `{showDetails: true}` to report [details](https://www.mongodb.com/docs/manual/reference/command/getParameter.md#std-label-showdetails-fields) on [`saslHostName`.](https://www.mongodb.com/docs/manual/reference/parameters.md#mongodb-parameter-param.saslHostName)

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

Example output:

```javascript
{
  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`](https://www.mongodb.com/docs/manual/reference/command/getParameter.md#mongodb-dbcommand-dbcmd.getParameter) with `{showDetails: true, allParameters: true}` to report [details](https://www.mongodb.com/docs/manual/reference/command/getParameter.md#std-label-showdetails-fields) on **all** parameters.

```javascript
db.adminCommand( { getParameter : { showDetails: true, allParameters: true } } )
```

### Retrieve All Startup Parameters

**New in version 8.0**

The following example runs the [`getParameter`](https://www.mongodb.com/docs/manual/reference/command/getParameter.md#mongodb-dbcommand-dbcmd.getParameter) command to retrieve all startup parameters:

```javascript
db.adminCommand( {
   getParameters: {
      allParameters: true,
      setAt: "startup"
   }
} )
```

### Retrieve All Runtime Parameters

**New in version 8.0**

The following example runs the [`getParameter`](https://www.mongodb.com/docs/manual/reference/command/getParameter.md#mongodb-dbcommand-dbcmd.getParameter) command to retrieve all runtime parameters:

```javascript
db.adminCommand( {
   getParameters: {
      allParameters: true,
      setAt: "runtime"
   }
} )
```
