Our server is multi-threaded and from what I can glime from the documentation it states that both mongodb c driver and bson is not thread safe.
However I would have thought that if using the client pool I could get a client object for the thread that needs it so that the client object is thread safe and then getting a collection object from the client using mongoc_client_get_collection() and then a cursor object from the collection object using mongoc_collection_find_with_opts(), it should all be thread safe.
All seems fine when performing requests across a single thread however if I start up a two or more threads I eventually get an issue where I am not seeing the correct data from the collection for that thread, I have created an assert that verifies that the data retrieved should be for that collection on a thread.
Do I have to put a mutex lock/unlock combination around every bson and mongoc call?
If that is the case the performance is going to be really bad.