Navigation
This version has reached end of life on October 2016. Learn more about upgrading your version of MongoDB.

rs.remove()

On this page

Definition

rs.remove(hostname)

Removes the member described by the hostname parameter from the current replica set. This function will disconnect the shell briefly and forces a reconnection as the replica set renegotiates which member will be primary. As a result, the shell will display an error even if this command succeeds.

The rs.remove() method has the following parameter:

Parameter Type Description
hostname string The hostname of a system in the replica set.

Note

Before running the rs.remove() operation, you must shut down the replica set member that you’re removing.

Changed in version 2.2: This procedure is no longer required when using rs.remove(), but it remains good practice.