Код: Выделить всё
DBConnection::DBConnection()
{
mongocxx::instance instance{};
mongocxx::uri uri("mongodb://localhost:27017");
mongocxx::client client(mongocxx::uri{});
coll = client["testdb"]["testcollection"];
auto curs = coll.find(bsoncxx::builder::stream::document{}
Подробнее здесь: [url]https://stackoverflow.com/questions/44636363/how-may-i-solve-this-mongocxx-connection-error[/url]