Hi everyone,
I am having a hard time working with the driver. The driver compiled successfully without problem. Boost was compiled on my system too.
I coded a very simple test program to test it and I am getting errors:
Basically the following is the code:
static mongo::DBClientReplicaSet replicaset(xxxxx019615", hosts, 0);
std::string errmsg;
mongo::client::initialize();
replicaset.connect();
replicaset.auth("databasename", "userid", "password", errmsg);
In debug mode, it showed error 0xc000a200 and was not able to debug at all since the program just won't start.
In release mode, it will stop working at starting up.
Firstly, I noticed there is a boost warning:
Assertion failed: px != 0, file C:\Boost\include\boost-1_62\boost/smart_ptr/scoped_ptr.hpp, line 105
Then I was able to choose to debug and here is the error:
When I broke the execution, I noticed the program stopped at replica_set_monitor.cpp (driver file) on the last line. Here is the part of the code:
void ReplicaSetMonitor::createIfNeeded(const string& name, const set<HostAndPort>& servers) {
LOG(3) << "ReplicaSetMonitor::createIfNeeded " << name;
boost::lock_guard<boost::mutex> lk(setsLock);
ReplicaSetMonitorPtr& m = sets[name];
if (!m)
m = boost::make_shared<ReplicaSetMonitor>(name, servers);
// Don't need to hold the lifetime lock for safeGo as
// 1) we assume the monitor is created as the contract of this class is such that initialize()
// must have been called.
// 2) replicaSetMonitorWatcher synchronizes safeGo internally using the _monitorMutex
replicaSetMonitorWatcher->safeGo();
}
I didn't do anything in my test program except loading the driver and try to do a query. Apparently, the driver didn't work so I was not able to test anything.
Please help!
Thanks!