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

replSetGetConfig

On this page

Definition

replSetGetConfig

Returns a document that describes the current configuration of the replica set. To invoke the command directly, use the following operation:

Tip

In the mongo Shell, this command can also be run through the rs.conf helper method.

Helper methods are convenient for mongo users, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.

db.runCommand( { replSetGetConfig: 1 } );

In the mongo shell, you can access the data provided by replSetGetConfig using the rs.conf() method, as in the following:

rs.conf();

Output Example

The following document provides a representation of a replica set configuration document. The configuration of your replica set may include only a subset of these settings:

{
  _id: <string>,
  version: <int>,
  protocolVersion: <number>,
  writeConcernMajorityJournalDefault: <boolean>,
  configsvr: <boolean>,
  members: [
    {
      _id: <int>,
      host: <string>,
      arbiterOnly: <boolean>,
      buildIndexes: <boolean>,
      hidden: <boolean>,
      priority: <number>,
      tags: <document>,
      slaveDelay: <int>,
      votes: <number>
    },
    ...
  ],
  settings: {
    chainingAllowed : <boolean>,
    heartbeatIntervalMillis : <int>,
    heartbeatTimeoutSecs: <int>,
    electionTimeoutMillis : <int>,
    catchUpTimeoutMillis : <int>,
    getLastErrorModes : <document>,
    getLastErrorDefaults : <document>,
    replicaSetId: <ObjectId>
  }
}

For description of the configuration settings, see Replica Set Configuration.