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


On this page



Returns a document that contains the current replica set configuration.


mongo Shell Method

This page documents a mongo method. This is not the documentation for database commands or language-specific drivers, such as Node.js. To use the database command, see the replSetGetConfig command.

For MongoDB API drivers, refer to the language-specific MongoDB driver documentation.

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.


rs.config() is an alias of rs.conf().

←   rs.addArb() rs.freeze()  →