- Reference >
- Database Commands >
- Administration Commands >
- getParameter
getParameter¶
-
getParameter
¶ getParameter
is an administrative command for retrieving the values of parameters. Use thedb.adminCommand( { command } )
method to run thegetParameter
command in theadmin
database.The
getParameter
command has the following syntax:The command takes the following fields:
Field Type Description getParameter
int, '*'
Specify a value of:
'*'
to return all parameters available togetParameters
, ignoring the<parameter>
field.- any numerical value to return the value for the specified
<parameter>
.
<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, in the
attr.command.cursor.comment
field. - Database profiler output, in the
command.comment
field. currentOp
output, in thecommand.comment
field.
A comment can be any valid BSON type (string, integer, object, array, etc).
New in version 4.4.
Behavior¶
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 for an
example of listing the available parameters.
Examples¶
Retrieve Single Parameter¶
The following operation runs getParameter
on the admin
database using a value of saslHostName
to retrieve the value for
that parameter:
The command returns the following output:
Note
The output may vary depending on the version and specific configuration of your MongoDB instance.
Retrieve All Parameters¶
The following operation runs getParameter
with a value of
'*'
to retrieve all parameters:
Note
The output may vary depending on the version of MongoDB and the specific configuration of the running MongoDB instance.
See also
setParameter
for more about these parameters.