問題
C++ ドライバーを使用して MongoDB にドキュメントを挿入しようとすると、次の例外メッセージが表示されます。
Wed Feb 27 15:21:38 Assertion failure p src/mongo/client/dbclientinterface.h 1096
0 assertion src/mongo/client/dbclientinterface.h:1096
私が知る限り、それはポート番号と関係があるようですか? dbclientinterface.h:1096 には次の行が含まれています。
MessagingPort& port() { verify(p); return *p; }
接続の設定 (main.cpp)
mongo::DBClientConnection DBConn( "localhost" );
mongo::DBClientConnection DBConn( "localhost:27017" ); // I've also tried this...
ドキュメントの挿入 (different_file.h)
while( m_Entries.size() ){
JsonBox::Value Data( m_Entries.front() );
try {
std::stringstream JSONDoc;
mongo::BSONObj BSONDoc;
Data["doc"].writeToStream( JSONDoc, false );
BSONDoc = mongo::fromjson( JSONDoc.str() );
// std::cout << Data["ns"].getString() << std::endl;
// std::cout << BSONDoc.toString() << std::endl;
// This is where the exception is thrown...
m_DBConn.insert( Data["ns"].getString(), BSONDoc );
} catch( const mongo::DBException& e ){
std::cout << e.toString() << std::endl;
}
m_EntriesMutex.lock();
m_Entries.pop();
m_EntriesMutex.unlock();
}