Navigation
This version of the documentation is archived and no longer supported.

mongod Parameters

On this page

Changed in version 2.4.

Synopsis

MongoDB provides a number of configuration options that are accessible via the --setParameter option to mongod. This document documents all of these options.

For additional run time configuration options, see Configuration File Options and Manual Page for mongod.

Parameters

enableLocalhostAuthBypass

New in version 2.4.

Specify 0 to disable localhost authentication bypass. Enabled by default.

enableLocalhostAuthBypass is not available using setParameter database command. Use the setParameter option in the configuration file or the --setParameter option on the command line.

journalCommitInterval

Specify an integer between 1 and 500 signifying the number of milliseconds (ms) between journal commits.

Consider the following example which sets the journalCommitInterval to 200 ms:

use admin
db.runCommand( { setParameter: 1, journalCommitInterval: 200 } )
logUserIds

New in version 2.4.

Specify 1 to enable logging of userids.

Disabled by default.

logLevel

Specify an integer between 0 and 5 signifying the verbosity of the logging, where 5 is the most verbose.

Consider the following example which sets the logLevel to 2:

use admin
db.runCommand( { setParameter: 1, logLevel: 2 } )

See also

verbose.

notablescan

Specify whether queries must use indexes. If 1, queries that perform a table scan instead of using an index will fail.

Consider the following example which sets notablescan to true:

use admin
db.runCommand( { setParameter: 1, notablescan: 1 } )

See also

notablescan

replIndexPrefetch

New in version 2.2.

Use replIndexPrefetch in conjunction with replSet. The default value is all and available options are:

  • none
  • all
  • _id_only

By default secondary members of a replica set will load all indexes related to an operation into memory before applying operations from the oplog. You can modify this behavior so that the secondaries will only load the _id index. Specify _id_only or none to prevent the mongod from loading any index into memory.

replApplyBatchSize

New in version 2.4.

Specify the number of oplog entries to apply as a single batch. replApplyBatchSize must be an integer between 1 and 1024. This option only applies to replica set members when they are in the secondary state.

Batch sizes must be 1 for members with slaveDelay configured.

saslHostName

New in version 2.4.

saslHostName overrides MongoDB’s default hostname detection for the purpose of configuring SASL and Kerberos authentication.

saslHostName does not affect the hostname of the mongod or mongos instance for any purpose beyond the configuration of SASL and Kerberos.

You can only set saslHostName during start-up, and cannot change this setting using the setParameter database command.

Note

saslHostName supports Kerberos authentication and is only included in MongoDB Enterprise. See Deploy MongoDB with Kerberos Authentication for more information.

supportCompatibilityFormPrivilegeDocuments

New in version 2.4.

supportCompatibilityFormPrivilegeDocuments is not available using setParameter database command. Use the setParameter option in the configuration file or the --setParameter option on the command line.

syncdelay

Specify the interval in seconds between fsync operations where mongod flushes its working memory to disk. By default, mongod flushes memory to disk every 60 seconds. In almost every situation you should not set this value and use the default setting.

Consider the following example which sets the syncdelay to 60 seconds:

db = db.getSiblingDB("admin")
db.runCommand( { setParameter: 1, syncdelay: 60 } )
traceExceptions

New in version 2.2.

Configures mongod log full stack traces on assertions or errors. If 1, mongod will log full stack traces on assertions or errors.

Consider the following example which sets the traceExceptions to true:

use admin
db.runCommand( { setParameter: 1, traceExceptions: true } )

See also

traceExceptions

quiet

Sets quiet logging mode. If 1, mongod will go into a quiet logging mode which will not log the following events/activities:

Consider the following example which sets the quiet to 1:

db = db.getSiblingDB("admin")
db.runCommand( { setParameter: 1, quiet: 1 } )

See also

quiet

textSearchEnabled

New in version 2.4.

Warning

  • Do not enable or use text search on production systems.

Enables the text search feature. You must enable the feature before creating or accessing a text index.

mongod --setParameter textSearchEnabled=true

If the flag is not enabled, you cannot create new text indexes, and you cannot perform text searches. However, MongoDB will continue to maintain existing text indexes.

releaseConnectionsAfterResponse

New in version 2.2.4: and 2.4.2

Changes the behavior of the connection pool that mongos uses to connect to the shards. As a result, each mongos should need to maintain fewer connections to each shard. When enabled, the mongos will release a connection into the thread pool after each read operation or command.

Warning

For applications that do not use the default, journaled, or replica acknowledged write concern modes of the driver, releaseConnectionsAfterResponse will affect the meaning of getLastError.

If an application allows read operations in between write operations and getLastError calls, the resulting getLastError will not report on the success of the proceeding write operation.

Use with caution.

To enable, use the following command while connected to a mongos:

use admin
db.runCommand( { setParameter: 1, releaseConnectionsAfterResponse: true } )

Alternately, you may start the mongos instance with the following run-time option:

mongos --setParameter releaseConnectionsAfterResponse=true

To change this policy for the entire cluster, you must set releaseConnectionsAfterResponse on each mongos instance in the cluster.

ttlMonitorEnabled

New in version 2.4.6.

To support TTL Indexes, mongod instances have a background thread that is responsible for deleting documents from collections with TTL indexes.

To disable this worker thread for a mongod, set ttlMonitorEnabled to false, as in the following operations:

use admin
db.runCommand( { setParameter: 1, ttlMonitorEnabled: false } )

Alternately, you may disable the thread at run-time by starting the mongod instance with the following option:

mongos --setParameter ttlMonitorEnabled=false