MongoDB Replication Command

MongoDB Replication Command

MongoDB isMaster Command

The role of the mongod instance is described by the document returned by the isMaster command. To create a specific user's credentials, an array of SASL mechanisms has been used. It is returned when saslSupportMechs is specified as an optional field. The isMaster command returns a subset of replica set if the instance is a member of the replica set.

isMaster command returns the associated information when sent to a mongod instance, which isn't a member of the replica set.

Syntax:


MongoDB Replication Command

MongoDB replySetAbortPrimaryCatchUp command

The command forces the specified primary member of the replica set to end sync then complete the transition to primary member.

Syntax:

MongoDB replSetGetConfig command

The command returns a document that specify the current configuration of the replica set. To fetch the command directly we have to use the following operation:

Syntax:

For Example - We have a document that represent a replica set configuration. It may include only a subset of the following settings:

MongoDB replSetInitiate command

The replSetInitiative command used to initializr a new replica set.

Syntax:

Example to pass the document to the rs.initiate(), helper:

MongoDB Replication Command

MongoDB replSetGetStatus command

The command returns the status to the replica set. It returns it from the server, which is used to process the document. The data returned by this command derives from data included in the signal sent to the server by other members of the set.

Syntax:

Example:

Output

MongoDB Replication Command




Latest Courses