首页 文章

Mongodb c驱动问题

提问于
浏览
2

我收到一个错误,说命名空间“bsoncxx :: v_noabi :: builder :: basic”没有成员“make_document”,我已经添加了必需包括在教程中提到的 .

我使用的是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选项才能实现我的目标 . 不确定bsoncxx :: builder :: basic :: make_document;选项可能已被删除或替换为我不知道的其他内容 .

1 回答

相关问题