Skip to content

DOCS-14765 Add Extra code examples for rs.reconfig() #5810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions source/reference/method/rs.reconfig.txt
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ A replica set named ``rs0`` has the following configuration:
}
}

Change Replica Set Member Priority
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The following sequence of operations updates the
:rsconf:`members[n].priority` of the second member.
The operations are issued through a :binary:`~bin.mongo` shell connected to
Expand Down Expand Up @@ -393,6 +396,24 @@ the primary.
}
}

Change Replica Set Settings
~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can also modify the cluster replica set :rsconf:`settings` document.
The :rsconf:`settings` document contains configuration options that
apply to the whole replica set.

The following sequence of operations updates the
:rsconf:`settings.heartbeatTimeoutSecs` of the cluster to ``15``.
The operations are issued through a :binary:`~bin.mongosh` session
that is connected to the primary.

.. code-block:: javascript

cfg = rs.conf();
cfg.settings.heartbeatTimeoutSecs = 15;
rs.reconfig(cfg);

.. seealso::

- :method:`rs.conf()`
Expand Down