This version of the documentation is archived and no longer supported.



The isMaster command provides a basic overview of the current replication configuration. MongoDB drivers and clients use this command to determine what kind of member they’re connected to and to discover additional members of a replica set. The db.isMaster() method provides a wrapper around this database command.

The command takes the following form:

{ isMaster: 1 }

This command returns a document containing the following fields:


The name of the current replica set, if applicable.


A boolean value that reports when this node is writable. If true, then the current node is either a primary in a replica set, a master in a master-slave configuration, or a standalone mongod.


A boolean value that, when true, indicates that the current member is a secondary member of a replica set.


An array of strings in the format of “[hostname]:[port]” listing all members of the replica set that are not “hidden”.


An array of strings in the format of “[hostname]:[port]” listing all members of the replica set that are arbiters

Only appears in the isMaster response for replica sets that have arbiter members.


A boolean value that, when true indicates that the current instance is an arbiter.

arbiterOnly only appears in the isMaster response from arbiters.


The [hostname]:[port] for the current replica set primary, if applicable.

The [hostname]:[port] of the node responding to this command.


The maximum permitted size of a BSON object in bytes for this mongod process. If not provided, clients should assume a max size of “4 * 1024 * 1024”.


New in version 2.1.1.

Returns the local server time in UTC. This value is a ISOdate. You can use the toString() JavaScript method to convert this value to a local date string, as in the following example:

←   group isSelf (internal)  →