mongo.destroy: Destroy a MongoDB connection

Description Usage Arguments Details See Also Examples

View source: R/mongo.R

Description

Destroy a mongo connection. The connection is disconnected first if it is still connected. No further communication is possible on the connection. Releases resources attached to the connection on both client and server.

Usage

1

Arguments

mongo

(mongo) a mongo connection object.

Details

Although the 'destroy' functions in this package are called automatically by garbage collection, this one in particular should be called as soon as feasible when finished with the connection so that server resources are freed.

See Also

mongo,
mongo.disconnect,
mongo.is.connected
mongo.reconnect.

Examples

1
2
3
4
5
6
mongo <- mongo.create()
if (mongo.is.connected(mongo)) {
    n_people <- mongo.count(mongo, "test.people")
    mongo.destroy(mongo)
    print(n_people)
}

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