Learn R Programming

rmongodb (version 1.8.0)

mongo.is.connected: Determine if a mongo object is connected to a MongoDB server

Description

Returns TRUE if the parameter mongo object is connected to a MongoDB server; otherwise, FALSE.

Usage

mongo.is.connected(mongo)

Arguments

mongo
(mongo) a mongo connection object.

Value

Logical TRUE if the mongo connection object is currently connected to a server; otherwise, FALSE.

See Also

mongo.create, mongo.

Examples

Run this code
mongo <- mongo.create()
if (mongo.is.connected(mongo)) {
    print(mongo.count(mongo, "test.people"))
}

Run the code above in your browser using DataLab