代码之家  ›  专栏  ›  技术社区  ›  Jo Joy

Mongodb c++驱动程序问题

  •  2
  • Jo Joy  · 技术社区  · 7 年前

    我在说命名空间“bsoncxx::v\u noabi::builder::basic”没有成员“make\u document”时出错,我已经根据教程中提到的添加了必需的include。

    我使用的是mongo-cxx-driver-r3.1.1版本。 i have followed example from here

    这是我试过的

           #include "maxi.h"
           #include <cstdlib>
           #include <iostream>
           #include <bsoncxx/builder/basic/array.hpp>
           #include <bsoncxx/builder/basic/document.hpp>
           #include <bsoncxx/builder/basic/kvp.hpp>
           #include <mongocxx/client.hpp>
           #include <mongocxx/instance.hpp>
    
        using bsoncxx::builder::basic::kvp;
        using bsoncxx::builder::basic::make_document;// here is error 
        using bsoncxx::type;
    
        mongocxx::instance inst{};
        mongocxx::client conn{ mongocxx::uri{ "mongodb://localhost:27017" } };
    

    see image here

    编译后,我已经测试了MongoDB驱动程序,它运行良好。出于某种原因,我需要使用make_document选项来实现我的目标。

    1 回复  |  直到 7 年前
        1
  •  2
  •   Joyo Waseem Pruthvi Menpara    7 年前

    在当前主分支中,文档。hpp文件包含make_document方法。 如果我没记错的话,您使用的是稳定版本。

    看看这里。 Using declaration “not found” in MongoDB c++ driver