Database Manual / Reference / Database Commands / Administration

setParameter (database command数据库命令)

Definition定义

setParameter
setParameter is an administrative command for modifying options normally set on the command line. 是一个管理命令,用于修改通常在命令行上设置的选项。You must issue the setParameter command against the admin database.您必须对admin数据库发出setParameter命令。

Compatibility兼容性

This command is available in deployments hosted in the following environments:此命令在以下环境中托管的部署中可用:

  • MongoDB Enterprise: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本
  • MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本

Important

This command is not supported in MongoDB Atlas clusters. MongoDB Atlas集群不支持此命令。For information on Atlas support for all commands, see Unsupported Commands.有关Atlas支持所有命令的信息,请参阅不支持的命令

Syntax语法

db.adminCommand(
{
setParameter: 1,
<parameter>: <value>
}
)

For the available parameters, including examples, see MongoDB Server Parameters for a Self-Managed Deployment.有关可用参数(包括示例),请参阅自我管理部署的MongoDB服务器参数

Behavior行为

Persistence坚持

Commands issued by the admin command setParameter do not survive server restarts. 由管理员命令setParameter发出的命令在服务器重启后无法继续执行。For a persistent option use the --setParameter command line option or the setParameter configuration file setting.对于持久选项,请使用--setParameter命令行选项或setParameter配置文件设置。

Stable APIAPI稳定

When using Stable API V1 with apiStrict set to true, you cannot use setParameter to modify server parameters.当使用apiStrict设置为trueStable API V1时,不能使用setParameter修改服务器参数。