I've installed (and have been using it for a while now) mongocxx driver via vcpkg and everything installed correctly and runs perfectly in Debug version (I'm using Visual Studio 2017 and my application is a Windows Form c++ (CLR) application). In my application, I get a connection pool and acquire a client everytime I upload some data on the server. Typical interval of my automatic data upload is 10 minutes. My settings are
// Create pool (once)
mongocxx::uri uri_remote{ "mongodb://user:pwd@remote-host:PORT/database-name?minPoolSize=2&maxPoolSize=5" };
mongocxx::pool pool_remote{ uri_remote };
// The code below runs as a scheduled process after every 10 minutes
auto client_remote = pool_remote.acquire();
// The client is returned to the pool when it goes out of scope.
auto collection_remote = (*client_remote)["database-name"]["collection-1-name"];
auto collection_st_remote = (*client_remote)["database-name"]["collection-2-name"];
bsoncxx::document::value doc1= document
<< std::string(keys[0]) << entries[0] // A short string (device identifier)
<< std::string(keys[1]) << entries[1] // A short string location
<< std::string(keys[2]) << bsoncxx::types::b_date(std::chrono::system_clock::now()) // Current insert time
<< std::string(keys[3]) << entries[2] // String: updated entry name
<< std::string(keys[4]) << entries[3] // String: Updated entry description
<< std::string(keys[5]) << <float number>
<< std::string(keys[6]) << <integer>
<< finalize;
// Below are the statuses I'm recording. A binary array (length = 7)
bsoncxx::document::value doc2= document
<< std::string(status_keys[0]) << statuses[0]
<< std::string(status_keys[1]) << statuses[1]
<< std::string(status_keys[2]) << statuses[2]
<< std::string(status_keys[3]) << statuses[3]
<< std::string(status_keys[4]) << bsoncxx::types::b_date(std::chrono::system_clock::now())
<< std::string(status_keys[5]) << statuses[4] // Device identifier
<< std::string(status_keys[6]) << statuses[5]
<< finalize;
// And finally insert
try {
// Insert remote. lines of code for doc1 and doc2 are skipped
collection_remote.insert_one(doc1.view());
collection_st_remote.insert_one(doc2.view());
// I'm skipping the rest of the code section here (just a catch statement after this). . .
The problem, the database documents get uploaded every 10 minutes without a problem in Debug version, but with the Release version (when I loaded the Release version of my application and started using that), the mongo insert doesn't work every time 10 minutes. It just misses/skips some entries (mostly one after a successful attempt according to what I observed).
With the release version loaded in a remote computer I'm unable to do any debugging even though I ran debug version which works perfectly with shorter intervals too (like 1 minute each).