-
Type: Task
-
Resolution: Gone away
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
The mongocxx driver API is designed such that you get a connection object from the pool and then you get a database from the connection. Any operations then happen over that connection I assume? So my question is do I need to keep the connection object alive while I use database/collection objects? e.g.
CollectionWrapper::CollectionWrapper { connection = pool.acquire(); db = connection.database("my_database"); m_collection = db.collection("my_collection); } // << connection object destroyed here but member variable m_collection is still alive
Or does the fact that I am keeping the collection alive is enough to ensure the connection is not returned to the pool?