jeroen / mongolite

Fast and Simple MongoDB Client for R
https://jeroen.github.io/mongolite/
286 stars 65 forks source link

How do I close the connection with mongo #138

Closed brunoroquette closed 6 years ago

brunoroquette commented 6 years ago

When I stop the mongo service before close the connection in my R script, the message: "Warning: [WARNING] Couldn't send "endSessions": Failure during socket delivery: Unknown error (10054)" is printed. So, I ask, is there a function to close the current connection?

jeroen commented 6 years ago

The connection is automatically closed by the R garbage collector when all objects that are using the connection are removed. So you could do:

rm(con)
gc()

But typically you shouldn't worry about it.

jeroen commented 6 years ago

mongolite 2.0 will have a disconnect() method to force closing the connection.