jeroen / mongolite

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

<simpleError in mongo_collection_new(client, collection, db): Client has been destroyed.> #184

Closed zhangzhaorui closed 3 years ago

zhangzhaorui commented 4 years ago

image

zhangzhaorui commented 4 years ago

R version 3.5.1

packageVersion("mongolite") [1] ‘2.0’

Hello,buddies when what happens, this error will appear

The error is "<simpleError in mongo_collection_new(client, collection, db): Client has been destroyed.>"

mspondon commented 3 years ago

I am facing the same issue with R version 4.0.3 and mongolite version 2.2.1

Observation: I have two functions which connects to the same database but differnet collection and perform an aggregate operation to get the data. Aggregation on function1 is working fine but function2 aggregation always throws error . In both the function I am making mongo connection hoping that connection pool will take care. I ran this : Rscript myscript.R Interesting when I run this using RStudio, its working.Any idea

jeroen commented 3 years ago

It could be a bug in mongolite that triggers a garbage collection if you have concurrent connections.

Can you try to create a small example for me that I can use to reproduce?

jeroen commented 3 years ago

This problem should be fixed in mongolite 2.3.0