How to update MongoDB by Object ID with C++ driver? -
i think have exhausted available documentation on this. using c++ bson drivers mongo, find record mongo, perform update on record based on found records object id. main area i'm struggling update query. example of i've tried doesn't work:
db.update("mydb.mycollection", query("_id" << objectid("521e68e5b9efcf5a9dff7052")), bson("$set" << bson("somefield" << "11111")));
i cannot find shred of documentation on how use c++ driver query or update based on _id field, in example unique field. example code appreciated, 1 runs find query, picks off objectid, , updates field on particular document.
i don't have driver compiled, however, thought casting oid
?
db.update("mydb.mycollection", query("_id" << oid("521e68e5b9efcf5a9dff7052")))
in case, there number of test cases located here may/not prove useful i've used in past "learn" how things in poorly documented driver.
Comments
Post a Comment