rs.status() (original) (raw)

rs.status()

Returns the replica set status from the point of view of the member where the method is run.

Important

mongosh Method

This page documents a mongosh method. This is _not_the documentation for database commands or language-specific drivers, such as Node.js.

For the database command, see the replSetGetStatus command.

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

This output reflects the current status of the replica set, using data derived from the heartbeat packets sent by the other members of the replica set.

Note

This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, seeUnsupported Commands.

For an example and details on the output, see replSetGetStatus.

If you run the mongosh helper method rs.status()(or the replSetGetStatus command) on a member during itsinitial sync (i.e. STARTUP2state), the command returns replSetGetStatus.initialSyncStatusmetrics.

Once the member completes its initial sync, thereplSetGetStatus.initialSyncStatus metrics becomes unavailable.