mongo.is.master: Determine if a mongo connection object is connected to a...

Description Usage Arguments Value See Also Examples

View source: R/mongo.R

Description

Determine if a mongo connection object is connected to a master. Normally, this is only used with replsets to see if we are currently connected to the master of the replset. However, when connected to a singleton, this function reports TRUE also.

Usage

1

Arguments

mongo

(mongo) a mongo connection object.

Value

(logical) TRUE if the server reports that it is a master; otherwise, FALSE.

See Also

mongo.create,
mongo.

Examples

1
2
3
4
5
6
7
8
## Not run: 
mongo <- mongo.create(c("127.0.0.1", "192.168.0.3"), name="Accounts")
if (mongo.is.connected(mongo)) {
    print("isMaster")
    print(if (mongo.is.master(mongo)) "Yes" else "No")
}

## End(Not run)

jonkatz2/rmongodb documentation built on May 19, 2019, 7:30 p.m.