On this page本页内容
getParameter
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.db.adminCommand( { command } )方法在admin数据库中运行getParameter命令。
The getParameter command has the following syntax:getParameter命令具有以下语法:
{
   getParameter: <value>,
   <parameter> : <value>,
   comment: <any>
}
The command takes the following fields:该命令接受以下字段:
| getParameter | int, string, document | 
 
 | 
| <parameter> | string | 
 
 | 
| comment | any | 
 
 
 
 | 
getParameter runs on the admin database only, and returns an error if run on any other database.getParameter仅在admin数据库上运行,如果在任何其他数据库上运行则返回错误。
The possible value for <parameter> may vary depending on what version and storage engine in use. <parameter>的可能值可能因使用的版本和存储引擎而异。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:saslHostName值在admin数据库上运行getParameter,以检索该参数的值:
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.输出可能因MongoDB实例的版本和特定配置而异。
{ "saslHostName" : "www.example.net:27018", "ok" : 1 }
The following operation runs 以下操作运行值为getParameter with a value of '*' to retrieve all parameters:'*'的getParameter以检索所有参数:
db.adminCommand( { getParameter : '*' } )
The output may vary depending on the version of MongoDB and the specific configuration of the running MongoDB instance.输出可能会因MongoDB的版本和正在运行的MongoDB实例的特定配置而异。
setParameter for more about these parameters.有关这些参数的详细信息。
The following example runs 以下示例使用getParameter with {showDetails: true} to report details on saslHostName.{showDetails: true}运行getParameter以报告saslHostName的详细信息。
db.adminCommand( { getParameter : { showDetails: true }, "saslHostName" : 1 } )
Example output:示例输出:
{
  saslHostName: {
    value: '<hostname>',
    settableAtRuntime: false,
    settableAtStartup: true
  },
  ok: 1
}
The output may vary depending on the version and specific configuration of your MongoDB instance.输出可能因MongoDB实例的版本和特定配置而异。
The following example runs 以下示例使用getParameter with {showDetails: true, allParameters: true} to report details on all parameters.{showDetails: true, allParameters: true}运行getParameter以报告所有参数的详细信息。
db.adminCommand( { getParameter : { showDetails: true, allParameters: true } } )