我目前正在尝试将 JSON 文件插入到我的 mongoDB 中。我已经看到过去通过使用 mongo::BSONObj 解决了这个问题......但这似乎不是一个选项,因为他们发布了用于 c++11 的新 mongocxx 驱动程序。这是我在 bsoncxx src 文件中找到的:
BSONCXX_API document::value BSONCXX_CALL from_json(stdx::string_view json);
/// Constructs a new document::value from the provided JSON text
///
/// @param 'json'
/// A string_view into a JSON document
///
/// @returns A document::value if conversion worked.
///
/// @throws bsoncxx::exception with error details if the conversion failed.
///
如何将我的 JSON 文件放入stdx::string_view
?
谢谢!