我在说命名空间“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;
using bsoncxx::type;
mongocxx::instance inst{};
mongocxx::client conn{ mongocxx::uri{ "mongodb://localhost:27017" } };
see image here
编译后,我已经测试了MongoDB驱动程序,它运行良好。出于某种原因,我需要使用make_document选项来实现我的目标。