【问题标题】:Upgrading MongoDB C++ Driver to mongocxx-3.1.2将 MongoDB C++ 驱动程序升级到 mongocxx-3.1.2
【发布时间】:2017-07-26 23:17:09
【问题描述】:

如何轻松地从 mongoDB C++ 驱动程序从 Legacy 升级到 mongocxx-3.1.2? mongocxx-3.1.2 中有哪些类可供关注?

mongo::BSONElement;
mongo::BSONObj;
mongo::BSONObjBuilder;

提前致谢..

【问题讨论】:

    标签: c++ mongodb bson mongo-cxx-driver


    【解决方案1】:

    没有“升级”——这些库提供完全不同的 API。您需要重写应用程序中与 BSON 或 MongoDB 交互的部分才能使用它(您还需要一个现代 C++ 工具链)。

    要了解您所询问的类型的类似物,我建议阅读https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/working-with-bson/

    库的当前稳定版本 (3.1.2) 的完整文档可在此处获得:https://mongodb.github.io/mongo-cxx-driver/api/current/

    详细说明您请求的类型的映射:

    • 与mongo::BSONElement 最接近的类似物是bsoncxx::document::element
    • 与mongo::BSONObj 最接近的类似物是bsoncxx::document::value 及其关联的视图类型bsoncxx::document::view。
    • 与mongo::BSONObjBuilder 最接近的类似物是bsoncxx::builder::basic::document。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-16
      • 2020-03-27
      • 2019-01-27
      • 2017-05-25
      • 1970-01-01
      • 1970-01-01
      • 2022-10-01
      • 2016-10-12
      相关资源
      最近更新 更多