MongoDB - db.isMaster()

By Yashwant Chavan, Views 2063, Date 29-Oct-2016

db.isMaster() - method returns document that describes the role of the mongod instance. If the instance is a member of a replica set, then isMaster returns a subset of the replica set configuration and status including whether or not the instance is the primary of the replica set. Refer following db.isMaster() method syntax.

tags mongodb

db.isMaster() syntax

db.isMaster()

db.isMaster() output

> db.isMaster()
{
        "ismaster" : true,
        "maxBsonObjectSize" : 16777216,
        "maxMessageSizeBytes" : 48000000,
        "maxWriteBatchSize" : 1000,
        "localTime" : ISODate("2016-10-29T10:35:52.506Z"),
        "maxWireVersion" : 5,
        "minWireVersion" : 0,
        "readOnly" : false,
        "ok" : 1
}
>
Yashwant Chavan

Yashwant Chavan

Hi there! I am founder of technicalkeeda.com and programming enthusiast. My skills includes Java,J2EE, Spring Framework, Nodejs, PHP and lot more. If you have any idea that you would want me to develop? Lets connect: yashwantchavan@gmail.com