Description Usage Arguments Details See Also Examples
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.
1 |
mongo |
(mongo) a mongo connection object. |
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.
mongo,
mongo.disconnect
,
mongo.is.connected
mongo.reconnect
.
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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.