Mongo(3 shards) C++ Driver: Syncclusterconnection error

Asked

Viewed 44 times

2

I’m having trouble running the upsert on Mongo when I connect to 3 shards on cpp. Now when I connect in just one of the shards I can do the operation. Does anyone have any alternative or knows the reason for this mistake?

CODE:

ConnectionString cs("mongodb://host:pass@server1:27017,server2:27017,server3:27017", ConnectionString::ConnectionType::SYNC);

DBClientBase *conn = cs.connect( mongo_erro );
BSONObjBuilder bojUpsert;

bojUpsert.append("teste","1234567890");
bojUpsert.append("valor",123);

conn->update("xxx.xxx", Query("{teste:\"1234567890\"}") , bojUpsert.obj() , mongo::UpdateOptions::UpdateOption_Upsert);

ERROR:

terminate called after Throwing an instance of 'Mongo::Userexception' what(): Syncclusterconnection::update upsert query needs _id

I’m using linux Mint, QT 4.8.6 + libmongo-client-dev 0.1.7-1

  • Why is the "C" tag? From what I’m seeing, your code is in C++ and C++ is different from C

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.