mongo-c-driver-1.6.2に基づくmongo-cxx-driver-r3.1.1を使用しています。 latest examples provided on githubを使用して、データベースの接続方法とドキュメントの保存方法を調べました。mongodbのC++ドライバで宣言「見つからない」を使用
私は、mongocxx/query.cpp exampleで提供されている情報に従ったフィルタを使用して結果を取得するのに苦労しています。
make_documentメソッドの呼び出しがたくさんありますが、その名前のbsoncxx名前空間にクラス/メソッド/テンプレートがありません(make_arrayと同じ問題)。
#include <bsoncxx/builder/basic/document.hpp>
#include <bsoncxx/builder/basic/array.hpp>
#include <bsoncxx/builder/basic/kvp.hpp>
#include <bsoncxx/types.hpp>
#include <bsoncxx/json.hpp>
#include <bsoncxx/stdx/make_unique.hpp>
#include <bsoncxx/stdx/optional.hpp>
#include <bsoncxx/stdx/string_view.hpp>
#include <mongocxx/instance.hpp>
#include <mongocxx/pool.hpp>
#include <mongocxx/stdx.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/logger.hpp>
#include <mongocxx/uri.hpp>
#include <mongocxx/exception/exception.hpp>
#include <mongocxx/options/find.hpp>
using namespace mongocxx;
using namespace bsoncxx;
using bsoncxx::builder::basic::document;
using bsoncxx::builder::basic::kvp;
using bsoncxx::builder::basic::sub_document;
using bsoncxx::builder::basic::sub_array;
using bsoncxx::builder::basic::array;
using bsoncxx::types::value;
using mongocxx::result::insert_one;
使用して宣言 "が見つかりません":
using bsoncxx::builder::basic::make_array;
using bsoncxx::builder::basic::make_document;
は、私が何かを明らかに足りない
は相続人、usingディレクティブと使用して宣言を含んでいるのか? 最近の例がありますか?
奇妙なことに、 'make_document'は[document.hpp](https://github.com/mongodb/mongo-cxx-driver/blob/master/src/bsoncxx/builder/basic/document.hpp)にあります。 'make_array'は両方とも含まれている[array.hpp](https://github.com/mongodb/mongo-cxx-driver/blob/master/src/bsoncxx/builder/basic/array.hpp)にあります。コンパイラの実際のエラーメッセージを提供してください。 –
ありがとう!私のdocument.hppにmake_documentテンプレート(およびmake_arrayテンプレートのarray.hpp)が含まれていないことに気がつきました。 私はそれらを追加して、今日の午後にテストします。新しい情報が入り次第お知らせします。 – Francois