Definition
- setClusterParameter
- setClusterParameteris 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 - setClusterParametercommand against the- admindatabase.
Compatibility
This command is available in deployments hosted in the following environments:
- MongoDB Enterprise: The subscription-based, self-managed version of MongoDB 
- MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB 
Important
This command is not supported in MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.
Syntax
db.adminCommand(    {      setClusterParameter: { <parameter>: <value> }    } ) 
For the available cluster parameters, including examples, see Cluster Parameters for a Self-Managed Deployment.
Behavior
- You can only run - setClusterParameteron the- admindatabase. If you run the command on any other database, MongoDB returns an error.
- You can only run - setClusterParameteron a replica set primary or on a sharded cluster.
- You cannot run - setClusterParameteron a standalone deployment.
- setClusterParameteraccepts only one parameter at a time.
Accesss Control
When authentication is enabled, setClusterParameter
only works when authenticated as a user with a role that has access
to the setClusterParameter action.
Persistence
The parameter modifications made using setClusterParameter
are persisted on replica sets and sharded clusters. This ensures that
parameter modifications made using setClusterParameter survive
restarts.
Stable API
When using Stable API V1 with apiStrict set to true, you cannot use
setClusterParameter to modify cluster parameters.