> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

# Self-Managed Replica Set Configuration

You can access the configuration of a [replica set](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-replica-set) using the [`rs.conf()`](https://www.mongodb.com/docs/manual/reference/method/rs.conf.md#mongodb-method-rs.conf) method or the [`replSetGetConfig`](https://www.mongodb.com/docs/manual/reference/command/replSetGetConfig.md#mongodb-dbcommand-dbcmd.replSetGetConfig) command.

To modify the configuration for a replica set, use the [`rs.reconfig()`](https://www.mongodb.com/docs/manual/reference/method/rs.reconfig.md#mongodb-method-rs.reconfig) method, passing a configuration document to the method.

**Warning:**

Avoid reconfiguring replica sets that contain members of different MongoDB versions as validation rules may differ across MongoDB versions.

## Replica Set Configuration Document 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:

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

## Replica Set Configuration Fields

*Type*: string

The name of the replica set.

[`_id`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf._id) *must* be identical to the [`replication.replSetName`](https://www.mongodb.com/docs/manual/reference/configuration-options.md#mongodb-setting-replication.replSetName) or the value of `--replSet` specified to [`mongod`](https://www.mongodb.com/docs/manual/reference/program/mongod.md#mongodb-binary-bin.mongod) on the command line.

**See also:**

[`replSetName`](https://www.mongodb.com/docs/manual/reference/configuration-options.md#mongodb-setting-replication.replSetName) or [`--replSet`](https://www.mongodb.com/docs/manual/reference/program/mongod.md#std-option-mongod.--replSet) for information on setting the replica set name.

*Type*: int

An incrementing number used to distinguish revisions of the replica set configuration document from previous iterations of the configuration.

Replica set members use [`term`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.term) and [`version`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.version) to achieve consensus on the "newest" replica configuration. When members compare replica configuration documents, the configuration document with a larger [`term`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.term) is considered the "newest". If [`term`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.term) is the same or absent, the configuration document with the larger [`version`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.version) is considered "newest".

*Type*: int

Only available with [featureCompatibilityVersion (FCV) "4.4"](https://www.mongodb.com/docs/manual/reference/command/setFeatureCompatibilityVersion.md#std-label-view-fcv) or later.

An incrementing number used to distinguish revisions of the replica set configuration document from previous iterations of the configuration. The [`term`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.term) of a configuration document matches the term of the replica set [primary](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-primary) which performed the reconfiguration. The [primary](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-primary) increments its term each time it steps up after winning an election. The primary ignores the [`term`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.term) field if set explicitly in the [`replSetReconfig`](https://www.mongodb.com/docs/manual/reference/command/replSetReconfig.md#mongodb-dbcommand-dbcmd.replSetReconfig) operation.

Issuing a [force](https://www.mongodb.com/docs/manual/reference/command/replSetReconfig.md#std-label-replSetReconfig-cmd-force) reconfiguration removes the [`term`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.term) field. When the primary next issues [`replSetReconfig`](https://www.mongodb.com/docs/manual/reference/command/replSetReconfig.md#mongodb-dbcommand-dbcmd.replSetReconfig) *without* force, it sets the [`term`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.term) to its own term.

Replica set members use [`term`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.term) and [`version`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.version) to achieve consensus on the "newest" replica configuration. When members compare replica configuration documents, the configuration document with a larger [`term`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.term) is considered the "newest". If [`term`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.term) is the same or absent, the configuration document with the larger [`version`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.version) is considered "newest".

*Type*: boolean

*Default*: false

Indicates whether the replica set is used for a sharded cluster's config servers. Set to `true` if the replica set is for a sharded cluster's config servers.

*Type*: number

*Default*: 1

MongoDB only supports `protocolVersion: 1` and no longer supports `protocolVersion: 0`.

**See also:**

[Self-Managed Replica Set Protocol Version](https://www.mongodb.com/docs/manual/reference/replica-set-protocol-versions.md#std-label-replica-set-protocol-version)

*Type*: boolean

*Default*: true

Determines the behavior of [`{ w: "majority" }`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) write concern if the write concern does not explicitly specify the journal option [j.](https://www.mongodb.com/docs/manual/reference/write-concern.md#std-label-wc-j)

The following table lists the `writeConcernMajorityJournalDefault` values and the associated [`{ w: "majority" }`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) behavior:

| Value | `{ w: "majority" }` Behavior |
| --- | --- |
| true | MongoDB acknowledges the write operation after a majority of the voting members have written to the on-disk journal. IMPORTANT: All voting members of the replica set must run with journaling when `writeConcernMajorityJournalDefault` is `true`. If any voting member of a replica set uses the [in-memory storage engine](https://www.mongodb.com/docs/manual/core/inmemory.md#std-label-storage-inmemory), you must set [`writeConcernMajorityJournalDefault`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.writeConcernMajorityJournalDefault) to `false`. If any voting member of a replica set uses the [in-memory storage engine](https://www.mongodb.com/docs/manual/core/inmemory.md#std-label-storage-inmemory) and [`writeConcernMajorityJournalDefault`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.writeConcernMajorityJournalDefault) is `true`, [`"majority"`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) write operations may fail. These include operations that inherently use [`"majority"`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) write concern, such as the [`replSetStepDown`](https://www.mongodb.com/docs/manual/reference/command/replSetStepDown.md#mongodb-dbcommand-dbcmd.replSetStepDown) command, or various [`mongosh`](https://www.mongodb.com/docs/mongodb-shell.md#mongodb-binary-bin.mongosh) methods that by default use [`"majority"`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) write concern, such as [user management methods](https://www.mongodb.com/docs/manual/reference/method.md#std-label-user-management-methods) and [role management methods.](https://www.mongodb.com/docs/manual/reference/method.md#std-label-role-management-methods) Starting in version 4.2 (and 4.0.13 and 3.6.14 ), if a replica set member uses the [in-memory storage engine](https://www.mongodb.com/docs/manual/core/inmemory.md#std-label-storage-inmemory) (voting or non-voting) but the replica set has [`writeConcernMajorityJournalDefault`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.writeConcernMajorityJournalDefault) set to true, the replica set member logs a startup warning. |
| false | MongoDB acknowledges the write operation after a majority of the voting members have applied the operation in memory. WARNING: If any voting member of a replica set uses the [in-memory storage engine](https://www.mongodb.com/docs/manual/core/inmemory.md#std-label-storage-inmemory), you must set [`writeConcernMajorityJournalDefault`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.writeConcernMajorityJournalDefault) to `false`. Starting in version 4.2 (and 4.0.13 and 3.6.14 ), if a replica set member uses the [in-memory storage engine](https://www.mongodb.com/docs/manual/core/inmemory.md#std-label-storage-inmemory) (voting or non-voting) but the replica set has [`writeConcernMajorityJournalDefault`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.writeConcernMajorityJournalDefault) set to true, the replica set member logs a startup warning. To run transactions on a sharded cluster, [`writeConcernMajorityJournalDefault`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.writeConcernMajorityJournalDefault) must be set to `true`. |

**See also:**

- [Acknowledgment Behavior](https://www.mongodb.com/docs/manual/reference/write-concern.md#std-label-wc-ack-behavior)

- [Self-Managed Replica Set Protocol Version](https://www.mongodb.com/docs/manual/reference/replica-set-protocol-versions.md#std-label-replica-set-protocol-version)

### `members`

*Type*: array

An array of member configuration documents, one for each member of the replica set. The [`members`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members) array is a zero-indexed array.

Each member-specific configuration document can contain the following fields:

*Type*: integer

An integer identifier for the member in the replica set, unique among all members.

Starting in MongoDB 5.0, values may be any integer value greater than or equal to `0`. Previously, this value was limited to an integer between `0` and `255` inclusive.

Each replica set member must have a unique [`_id`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-._id). Avoid re-using `_id` values *even if* no `members[n]` entry is using that `_id` in the current configuration.

Once set, you cannot change the [`_id`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-._id) of a member.

**Note:**

When updating the replica configuration object, access the replica set members in the [`members`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members) array with the **array index**. The array index begins with `0`. Do **not** confuse this index value with the value of the [`members[n]._id`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-._id) field in each document in the [`members`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members) array.

*Type*: string

The hostname and, if specified, the port number, of the set member.

The host name must be resolvable for every host in the replica set.

**Warning:**

[`members[n].host`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.host) cannot hold a value that resolves to `localhost` or the local interface unless *all* members of the set are on hosts that resolve to `localhost`.

*Optional*.

*Type*: boolean

*Default*: false

A boolean that identifies an arbiter. A value of `true` indicates that the member is an arbiter.

When using the [`rs.addArb()`](https://www.mongodb.com/docs/manual/reference/method/rs.addArb.md#mongodb-method-rs.addArb) method to add an arbiter, the method automatically sets [`members[n].arbiterOnly`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.arbiterOnly) to `true` for the added member.

*Optional*.

*Type*: boolean

*Default*: true

A boolean that indicates whether the [`mongod`](https://www.mongodb.com/docs/manual/reference/program/mongod.md#mongodb-binary-bin.mongod) builds [indexes](https://www.mongodb.com/docs/manual/reference/command/collMod.md#mongodb-collflag-index) on this member. You can only set this value when adding a member to a replica set. You cannot change [`members[n].buildIndexes`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.buildIndexes) field after the member has been added to the set. To add a member, see [`rs.add()`](https://www.mongodb.com/docs/manual/reference/method/rs.add.md#mongodb-method-rs.add) and [`rs.reconfig()`.](https://www.mongodb.com/docs/manual/reference/method/rs.reconfig.md#mongodb-method-rs.reconfig)

Do not set to `false` for [`mongod`](https://www.mongodb.com/docs/manual/reference/program/mongod.md#mongodb-binary-bin.mongod) instances that receive queries from clients.

Setting `buildIndexes` to `false` may be useful if **all** the following conditions are true:

- you are only using this instance to perform backups using [`mongodump`](https://www.mongodb.com/docs/database-tools/mongodump.md#mongodb-binary-bin.mongodump), *and*

- this member will receive no queries, *and*

- index creation and maintenance overburdens the host system.

Even if set to `false`, secondaries *will* build indexes on the `_id` field to facilitate operations required for replication.

**Warning:**

If you set [`members[n].buildIndexes`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.buildIndexes) to `false`, you must also set [`members[n].priority`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.priority) to `0`. If [`members[n].priority`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.priority) is not `0`, MongoDB will return an error when attempting to add a member with [`members[n].buildIndexes`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.buildIndexes) equal to `false`.

To ensure the member receives no queries, you should make all instances that do not build indexes hidden.

Other secondaries cannot replicate from a member where [`members[n].buildIndexes`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.buildIndexes) is false.

*Optional*.

*Type*: boolean

*Default*: false

When this value is `true`, the replica set hides this instance and does not include the member in the output of [`db.hello()`](https://www.mongodb.com/docs/manual/reference/method/db.hello.md#mongodb-method-db.hello) or [`hello`](https://www.mongodb.com/docs/manual/reference/command/hello.md#mongodb-dbcommand-dbcmd.hello). This prevents read operations (that is, queries) from ever reaching this host by way of secondary [read preference.](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-read-preference)

Hidden members can acknowledge write operations issued with [Write Concern](https://www.mongodb.com/docs/manual/reference/write-concern.md#std-label-write-concern). For write operations issued with [`"majority"`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) write concern, the member must also be a voting member (that is, [`votes`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.votes) is greater than `0`).

**See also:**

[Hidden Replica Set Members](https://www.mongodb.com/docs/manual/core/replica-set-hidden-member.md#std-label-replica-set-hidden-members)

*Optional*.

*Type*: Number between 0 and 1000 for primary/secondary members, or 0 or 1 for arbiters.

*Default*: 1.0 for primary/secondary members, or 0 for arbiters.

A number that indicates the relative likelihood of a replica set member to become the [primary.](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-primary)

- To increase the likelihood that a member becomes the primary, specify a higher `priority` value for that member.

- To decrease the likelihood that a member becomes the primary, specify a lower `priority` value for that member.

Changing a member's priority triggers one or more elections. The election algorithm makes a best-effort attempt to elect the highest-priority member the primary. However, a lower-priority member may become the primary even if a higher-priority secondary is available.

If a lower-priority member becomes the primary, the server continues to periodically call elections until the highest-priority replica set member is the primary. The frequency at which the elections occur depends on the difference in priority between the elected member and the highest-priority member.

A member with a priority of `0` cannot become the primary.

Non-voting members (meaning members that have [`votes`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.votes) set to `0`) must have a priority of `0`.

**See also:**

- [Replica Set Elections](https://www.mongodb.com/docs/manual/core/replica-set-elections.md#std-label-replica-set-elections)

- [Member Priority](https://www.mongodb.com/docs/manual/core/replica-set-elections.md#std-label-rs-election-priority)

*Optional*.

*Type*: document

*Default*: none

A `tags` document contains user-defined tag field and value pairs for the replica set member.

```javascript
{ "<tag1>": "<string1>", "<tag2>": "<string2>",... }
```

- For read operations, you can specify a tag set in the [read preference](https://www.mongodb.com/docs/manual/core/read-preference-tags.md#std-label-replica-set-read-preference-tag-sets) to direct the operations to replica set member(s) with the specified tag(s).

- For write operations, you can create a customize [write concern](https://www.mongodb.com/docs/manual/reference/write-concern.md) using [`settings.getLastErrorModes`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.settings.getLastErrorModes) and [`settings.getLastErrorDefaults`.](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.settings.getLastErrorDefaults)

For more information, see [Configure Replica Set Tag Sets.](https://www.mongodb.com/docs/manual/tutorial/configure-replica-set-tag-sets.md#std-label-replica-set-configuration-tag-sets)

*Optional*.

*Type*: integer

*Default*: 0

The number of seconds "behind" the primary that this replica set member should "lag".

Use this option to create [delayed members](https://www.mongodb.com/docs/manual/core/replica-set-delayed-member.md#std-label-replica-set-delayed-members). Delayed members maintain a copy of the data that reflects the state of the data at some time in the past.

Delayed members can contribute to acknowledging write operations issued with [Write Concern](https://www.mongodb.com/docs/manual/reference/write-concern.md#std-label-write-concern). However, they return write acknowledgment no earlier than the configured delay value. For write operations issued with [`"majority"`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) write concern, the member must also be a voting member (that is, [`votes`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.votes) is greater than `0`).

**See also:**

[Delayed Replica Set Members](https://www.mongodb.com/docs/manual/core/replica-set-delayed-member.md#std-label-replica-set-delayed-members)

*Optional*.

*Type*: integer

*Default*: 1

The number of votes a server will cast in a [replica set election](https://www.mongodb.com/docs/manual/core/replica-set-elections.md#std-label-replica-set-elections). The number of votes each member has is either `1` or `0`, and [arbiters](https://www.mongodb.com/docs/manual/core/replica-set-members.md#std-label-replica-set-arbiters) always have exactly `1` vote.

Members with [`priority`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.priority) greater than 0 cannot have 0 [`votes`.](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.votes)

A replica set can have up to [50 members](https://www.mongodb.com/docs/manual/reference/limits.md#mongodb-limit-Number-of-Members-of-a-Replica-Set) but only 7 voting members. If you need more than 7 members in one replica set, set [`members[n].votes`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.votes) to `0` for the additional non-voting members.

Non-voting (i.e. [`votes`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.votes) is `0`) members must have [`priority`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.priority) of 0.

Starting in MongoDB 5.0, a newly added secondary does not count as a voting member and cannot be elected until it has reached [`SECONDARY`](https://www.mongodb.com/docs/manual/reference/replica-states.md#mongodb-replstate-replstate.SECONDARY) state.

Non-voting members cannot acknowledge write operations issued with a [`"majority"`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) write concern.

**See also:**

- [`replSetGetStatus.votingMembersCount`](https://www.mongodb.com/docs/manual/reference/command/replSetGetStatus.md#mongodb-data-replSetGetStatus.votingMembersCount)

- [`replSetGetStatus.writableVotingMembersCount`](https://www.mongodb.com/docs/manual/reference/command/replSetGetStatus.md#mongodb-data-replSetGetStatus.writableVotingMembersCount)

### `settings`

*Optional*.

*Type*: document

A document that contains configuration options that apply to the whole replica set.

The [`settings`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.settings) document contains the following fields:

*Optional*.

*Type*: boolean

*Default*: true

In MongoDB 5.0.1 and earlier, if [`settings.chainingAllowed`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.settings.chainingAllowed) is:

- `true`, replica set [secondary](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-secondary) members can replicate data from other secondary members.

- `false`, secondary members can replicate data only from the [primary.](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-primary)

Starting in MongoDB 5.0.2:

- With an override enabled, replica set [secondary](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-secondary) members can replicate data from other secondary members even if [`settings.chainingAllowed`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.settings.chainingAllowed) is `false`.

- To override [`settings.chainingAllowed`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.settings.chainingAllowed) and allow replication from a secondary member, set the [`enableOverrideClusterChainingSetting`](https://www.mongodb.com/docs/manual/reference/parameters.md#mongodb-parameter-param.enableOverrideClusterChainingSetting) server parameter to `true`.

- The default for [`enableOverrideClusterChainingSetting`](https://www.mongodb.com/docs/manual/reference/parameters.md#mongodb-parameter-param.enableOverrideClusterChainingSetting) is `false`.

**See also:**

[Self-Managed Chained Replication](https://www.mongodb.com/docs/manual/tutorial/manage-chained-replication.md#std-label-chained-replication)

*Optional*.

*Type*: document

Unavailable starting in MongoDB 5.0.

**Important:**

Starting in MongoDB 5.0, you cannot specify a default write concern with [`settings.getLastErrorDefaults`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.settings.getLastErrorDefaults) other than the default of `{ w: 1, wtimeout: 0 }` . Instead, use the [`setDefaultRWConcern`](https://www.mongodb.com/docs/manual/reference/command/setDefaultRWConcern.md#mongodb-dbcommand-dbcmd.setDefaultRWConcern) command to set the default read or write concern configuration for a replica set or sharded cluster.

*Optional*.

*Type*: document

A document used to define a custom [write concern](https://www.mongodb.com/docs/manual/reference/write-concern.md#std-label-write-concern) through the use of [`members[n].tags`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.tags). The custom write concern can provide [data-center awareness.](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-data-center-awareness)

```none
{ getLastErrorModes: {
   <name of write concern> : { <tag1>: <number>, .... },
   ...
} }
```

The `<number>` refers to the number of different tag values required to satisfy the write concern. For example, the following [`settings.getLastErrorModes`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.settings.getLastErrorModes) defines a write concern named `datacenter` that requires the write to propagate to two members whose `dc` tag values differ.

```none
{ getLastErrorModes: { datacenter: { "dc": 2 } } }
```

To use the custom write concern, pass in the write concern name to the [`w` Option](https://www.mongodb.com/docs/manual/reference/write-concern.md#std-label-wc-w), for example:

```none
{ w: "datacenter" }
```

See [Configure Replica Set Tag Sets](https://www.mongodb.com/docs/manual/tutorial/configure-replica-set-tag-sets.md#std-label-replica-set-configuration-tag-sets) for more information and example.

*Optional*.

*Type*: int

*Default*: 10

Number of seconds that the replica set members wait for a successful heartbeat from each other. If a member does not respond in time, other members mark the delinquent member as inaccessible.

*Optional*.

*Type*: int

*Default*: 10000 (10 seconds)

The time limit in milliseconds for detecting when a replica set's primary is unreachable. This setting controls failover sensitivity when using [`protocolVersion: 1`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.protocolVersion). You can expect the failover timeout to not exceed the value of `electionTimeoutMillis`.

Consider the following when selecting a value:

- Higher values result in slower failovers but decreased sensitivity to primary node or network slowness or spottiness.

- Lower values result in faster failover but increased sensitivity to primary node or network slowness or spottiness.

The setting only applies when using [`protocolVersion: 1`.](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.protocolVersion)

**Note:**

When you step down a primary using [`rs.stepDown()`](https://www.mongodb.com/docs/manual/reference/method/rs.stepDown.md#mongodb-method-rs.stepDown) or [`replSetStepDown`](https://www.mongodb.com/docs/manual/reference/command/replSetStepDown.md#mongodb-dbcommand-dbcmd.replSetStepDown) without setting the `force` field to `true`, the stepped-down primary nominates an eligible secondary to call an election immediately.

*Optional*.

*Type*: int

*Default*: -1, infinite catchup time.

Time limit in milliseconds for a newly elected primary to sync (catch up) with the other replica set members that may have more recent writes. Infinite or high time limits may reduce the amount of data that the other members would need to roll back after an election but may increase the failover time.

The newly elected primary ends the catchup period early once it is fully caught up with other members of the set. During the catchup period, the newly elected primary is unavailable for writes from clients. Use [`replSetAbortPrimaryCatchUp`](https://www.mongodb.com/docs/manual/reference/command/replSetAbortPrimaryCatchUp.md#mongodb-dbcommand-dbcmd.replSetAbortPrimaryCatchUp) to abort the catchup then complete the transition to primary.

The setting only applies when using [`protocolVersion: 1`.](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.protocolVersion)

*Optional*.

*Type*: int

*Default*: 30000 (30 seconds)

Time in milliseconds a node waits to initiate a *catchup takeover* after determining it is ahead of the current [primary](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-primary). During a catchup takeover, the node ahead of the current primary initiates an [election](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-election) to become the new primary of the [replica set.](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-replica-set)

After the node initiating the takeover determines that it is ahead of the current [primary](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-primary), it waits the specified number of milliseconds and then verifies the following:

1. It is still ahead of the current primary,

2. It is the most up-to-date node among all available nodes,

3. The current primary is currently catching up to it.

Once determining that all of these conditions are met, the node initiating the takeover immediately runs for election.

For more information on Replica Set Elections, see [Replica Set Elections.](https://www.mongodb.com/docs/manual/core/replica-set-elections.md#std-label-replica-set-elections)

**Note:**

Setting `catchUpTakeoverDelayMillis` to `-1` disables catchup takeover. Setting [`catchUpTimeoutMillis`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.settings.catchUpTimeoutMillis) to `0` disables *primary catchup* and consequently also catchup takeover.

*Internal use only*.

The frequency in milliseconds of the heartbeats.

*Type*: ObjectId

The ObjectId associated with the replica set and automatically created during [`rs.initiate()`](https://www.mongodb.com/docs/manual/reference/method/rs.initiate.md#mongodb-method-rs.initiate) or [`replSetInitiate`](https://www.mongodb.com/docs/manual/reference/command/replSetInitiate.md#mongodb-dbcommand-dbcmd.replSetInitiate). You cannot change the [`replicaSetId`.](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.settings.replicaSetId)
