Docs Menu
Docs Home
/
MongoDB Manual
/ / /

setClusterParameter

On this page

  • Definition
  • Compatibility
  • Syntax
  • Behavior
setClusterParameter

setClusterParameter is an administrative command for modifying values of cluster parameters. Cluster parameters are configurable parameters which affect all nodes in a replica set or sharded cluster.

You must issue the setClusterParameter command against the admin database.

The setClusterParameter command is only available in self-managed installations. The setClusterParameter command is not available in MongoDB Atlas.

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

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud

Note

This command is supported in all MongoDB Atlas clusters. For information on all commands, see Unsupported Commands.

db.adminCommand(
{
setClusterParameter: { <parameter>: <value> }
}
)

For the available cluster parameters, including examples, see Cluster Parameters.

  • You can only run setClusterParameter on the admin database. If you run the command on any other database, MongoDB returns an error.

  • You can only run setClusterParameter on a replica set primary or on a sharded cluster.

  • You cannot run setClusterParameter on a standalone deployment.

When authentication is enabled, setClusterParameter only works when authenticated as a user with a role that has access to the setClusterParameter action.

The parameter modifications made using setClusterParameter are persisted on replica sets and sharded clusters. This ensures that parameter modifications made using setClusterParameter survive restarts.

When using Stable API V1 with apiStrict set to true, you cannot use setClusterParameter to modify cluster parameters.

← setAuditConfig