MongoDB: db.isMaster() method
db.isMaster
The db.isMaster() method is used to return a document that reports the state of the replica set. If the mongod is a member of a replica set, then the ismaster and secondary fields report if the instance is the primary or if it is a secondary member of the replica set.
Syntax:
db.isMaster()
Example: MongoDB: db.isMaster() method
db.isMaster();
Output:
> db.isMaster();
{
"ismaster" : true,
"maxBsonObjectSize" : 16777216,
"maxMessageSizeBytes" : 48000000,
"maxWriteBatchSize" : 1000,
"localTime" : ISODate("2016-01-11T11:44:00.610Z"),
"maxWireVersion" : 2,
"minWireVersion" : 0,
"ok" : 1
}
Retrieve the restaurants data from here
Previous:
db.hostInfo() method
Next:
db.listCommands() method
