mercredi 27 juillet 2016

Mongo(3 shards) Driver C++: When Upsert "erro SyncClusterConnection"

I have a problem to run command "upsert" in the mongo when connect in 3 shards. Now when I connecting only one Shard, I haven't problems.

CODE:

ConnectionString cs("http://mongodbhost: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

Aucun commentaire:

Enregistrer un commentaire