翻译或纠错本页面

getParameter

On this page

getParameter

getParameter is an administrative command for retrieving the value of options normally set on the command line. Use the db.runCommand( { command } ) method to run the getParameter command.

The getParameter command has the following syntax:

{
   getParameter: <value>,
   <parameter> : <value>
}

The command takes the following fields:

Field Type Description
getParameter int, *

* returns all parameters available to getParameters, ignoring the <parameter> field.

The value for <value> does not effect output otherwise.

<parameter> string

String name of the parameter to retrieve.

The value for <value> does not affect output.

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:

use admin
db.runCommand( { 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.

{ "saslHostName" : "www.example.net:27018", "ok" : 1 }

Retrieve All Parameters

The following operation runs getParameter on the admin database using a value of * to retrieve all parameters:

use admin
db.runCommand( { getParameter : '*' } )

The command returns the following output:

注解

The output may vary depending on the version of MongoDB and the specific configuration of the running MongoDB instance.

{
   "authSchemaVersion" : 5,
   "authenticationMechanisms" : [
      "MONGODB-CR",
      "MONGODB-X509",
      "SCRAM-SHA-1"
   ],
   "clientCursorMonitorFrequencySecs" : 4,
   "clusterAuthMode" : "undefined",
   "connPoolMaxConnsPerHost" : 200,
   "connPoolMaxShardedConnsPerHost" : 200,
   "cursorTimeoutMillis" : 600000,
   "diagnosticDataCollectionDirectorySizeMB" : 200,
   "diagnosticDataCollectionEnabled" : true,
   "diagnosticDataCollectionFileSizeMB" : 10,
   "diagnosticDataCollectionPeriodMillis" : 1000,
   "diagnosticDataCollectionSamplesPerChunk" : 300,
   "diagnosticDataCollectionSamplesPerInterimUpdate" : 10,
   "disableJavaScriptJIT" : false,
   "enableLocalhostAuthBypass" : true,
   "enableReplSnapshotThread" : false,
   "enableTestCommands" : false,
   "failIndexKeyTooLong" : true,
   "featureCompatibilityVersion" : "3.4",
   "initialSyncOplogBuffer" : "collection",
   "internalDocumentSourceCursorBatchSizeBytes" : 16777216,
   "internalGeoNearQuery2DMaxCoveringCells" : 16,
   "internalGeoPredicateQuery2DMaxCoveringCells" : 16,
   "internalQueryCacheEvictionRatio" : 10,
   "internalQueryCacheFeedbacksStored" : 20,
   "internalQueryCacheSize" : 5000,
   "internalQueryEnumerationMaxIntersectPerAnd" : 3,
   "internalQueryEnumerationMaxOrSolutions" : 10,
   "internalQueryExecMaxBlockingSortBytes" : 33554432,
   "internalQueryExecYieldIterations" : 128,
   "internalQueryExecYieldPeriodMS" : 10,
   "internalQueryFacetBufferSizeBytes" : 104857600,
   "internalQueryForceIntersectionPlans" : false,
   "internalQueryMaxScansToExplode" : 200,
   "internalQueryPlanEvaluationCollFraction" : 0.3,
   "internalQueryPlanEvaluationMaxResults" : 101,
   "internalQueryPlanEvaluationWorks" : 10000,
   "internalQueryPlanOrChildrenIndependently" : true,
   "internalQueryPlannerEnableHashIntersection" : false,
   "internalQueryPlannerEnableIndexIntersection" : true,
   "internalQueryPlannerMaxIndexedSolutions" : 64,
   "internalQueryS2GeoCoarsestLevel" : 0,
   "internalQueryS2GeoFinestLevel" : 23,
   "internalQueryS2GeoMaxCells" : 20,
   "javascriptProtection" : false,
   "journalCommitInterval" : 0,
   "jsHeapLimitMB" : 1100,
   "logComponentVerbosity" : {
      "verbosity" : 0,
      "accessControl" : {
         "verbosity" : -1
      },
      "command" : {
         "verbosity" : -1
      },
      "control" : {
         "verbosity" : -1
      },
      "executor" : {
         "verbosity" : -1
      },
      "geo" : {
         "verbosity" : -1
      },
      "index" : {
         "verbosity" : -1
      },
      "network" : {
         "verbosity" : -1,
         "asio" : {
            "verbosity" : -1
         },
         "bridge" : {
            "verbosity" : -1
         }
      },
      "query" : {
         "verbosity" : -1
      },
      "replication" : {
         "verbosity" : -1
      },
      "sharding" : {
         "verbosity" : -1
      },
      "storage" : {
         "verbosity" : -1,
         "journal" : {
            "verbosity" : -1
         }
      },
      "write" : {
         "verbosity" : -1
      },
      "ftdc" : {
         "verbosity" : -1
      }
   },
   "logLevel" : 0,
   "logUserIds" : false,
   "maxLogSizeKB" : 10,
   "maxSyncSourceLagSecs" : 30,
   "messagePortImpl" : "legacy",
   "newCollectionsUsePowerOf2Sizes" : true,
   "notablescan" : false,
   "numInitialSyncAttempts" : 10,
   "numInitialSyncCollectionFindAttempts" : 3,
   "numInitialSyncConnectAttempts" : 10,
   "numInitialSyncListCollectionsAttempts" : 3,
   "numInitialSyncListDatabasesAttempts" : 3,
   "numInitialSyncListIndexesAttempts" : 3,
   "numInitialSyncOplogFindAttempts" : 3,
   "oplogFetcherMaxFetcherRestarts" : 10,
   "quiet" : false,
   "replApplyBatchSize" : 1,
   "replBatchLimitOperations" : 50000,
   "replElectionTimeoutOffsetLimitFraction" : 0.15,
   "replIndexPrefetch" : "uninitialized",
   "replSnapshotThreadThrottleMicros" : 1000,
   "replWriterThreadCount" : 16,
   "saslHostName" : "www.example.net:27018",
   "saslServiceName" : "mongodb",
   "saslauthdPath" : "",
   "scramIterationCount" : 10000,
   "scriptingEngineInterruptIntervalMS" : 1000,
   "skipCorruptDocumentsWhenCloning" : false,
   "sslMode" : "disabled",
   "startupAuthSchemaValidation" : true,
   "syncdelay" : 60,
   "taskExecutorPoolSize" : 0,
   "testingSnapshotBehaviorInIsolation" : false,
   "traceExceptions" : false,
   "traceWriteConflictExceptions" : false,
   "ttlMonitorEnabled" : true,
   "ttlMonitorSleepSecs" : 60,
   "use3dot2InitialSync" : false,
   "wiredTigerConcurrentReadTransactions" : 128,
   "wiredTigerConcurrentWriteTransactions" : 128,
   "wiredTigerEngineRuntimeConfig" : "",
   "writePeriodicNoops" : true,
   "ok" : 1
}

参见

setParameter for more about these parameters.