Query nested BSON documents with mongo c++ driver
问题 I have a bsoncxx::document::view bsonObjView and a std::vector<std::string> path that represents keys to the value we are searching for in the BSON document (first key is top level, second key is depth 1, third key depth 2, etc). I'm trying to write a function that given a path will search the bson document: bsoncxx::document::element deepFieldAccess(bsoncxx::document::view bsonObj, const std::vector<std::string>& path) { assert (!path.empty()); // for each key, find the corresponding value