rmongodb (version 1.8.0)

mongo.disconnect: Disconnect from a MongoDB server

Description

Disconnect from a MongoDB server. No further communication is possible on the connection. However, mongo.reconnect() may be called on the mongo object to restablish the connection.

Usage

mongo.disconnect(mongo)

Arguments

mongo
(mongo) a mongo connection object.

Value

The mongo object is returned.

See Also

mongo, mongo.create, mongo.reconnect, mongo.is.connected.

Examples

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

Run the code above in your browser using DataLab