b_string、make_document 和 db.gridfs_bucket() 中的错误,我正在使用 bsoncxx 3.8.0 和 mongocxx 驱动程序 3.8.0 [已关闭]

问题描述 投票:0回答:0
/opt/mongo-cxx-driver-r3.7.2/src/bsoncxx/types/bson_value/view.hpp:111:30: error: ‘b_string’ does not name a type
  111 |     BSONCXX_DEPRECATED const b_string& get_utf8() const;
      |                              ^~~~~~~~
/opt/mongo-cxx-driver-r3.7.2/src/bsoncxx/types/bson_value/view.hpp:119:11: error: ‘b_string’ does not name a type
  119 |     const b_string& get_string() const;
      |           ^~~~~~~~
/opt/mongo-cxx-driver-r3.7.2/src/bsoncxx/types/bson_value/view.hpp:287:25: error: field ‘_b_string’ has incomplete type ‘bsoncxx::v_noabi::types::bson_value::b_string’
  287 |         struct b_string _b_string;
      |                         ^~~~~~~~~
/opt/mongo-cxx-driver-r3.7.2/src/bsoncxx/types/bson_value/view.hpp:287:16: note: forward declaration of ‘struct bsoncxx::v_noabi::types::bson_value::b_string’
  287 |         struct b_string _b_string;
      |                ^~~~~~~~
mongoex.cpp:29:32: error: ‘make_document’ has not been declared in ‘bsoncxx::v_noabi::builder::basic’
   29 | using bsoncxx::builder::basic::make_document;
      |                                ^~~~~~~~~~~~~
mongoex.cpp: In member function ‘int DBFileHandler::saveFiles(const std::string&, std::string&)’:
/home/vehant/swathy/mongo_cmake/mongoex.cpp:52:30: error: ‘class mongocxx::v_noabi::database’ has no member named ‘gridfs_bucket’
   52 |             auto bucket = db.gridfs_bucket();
      |                              ^~~~~~~~~~~~~
mongoex.cpp: In member function ‘int DBFileHandler::retrieveFiles(const std::string&)’:
/home/vehant/swathy/mongo_cmake/mongoex.cpp:99:30: error: ‘class mongocxx::v_noabi::database’ has no member named ‘gridfs_bucket’
   99 |             auto bucket = db.gridfs_bucket();
      |                              ^~~~~~~~~~~~~
mongoex.cpp:102:71: error: ‘make_document’ is not a member of ‘bsoncxx::v_noabi::builder::basic’; did you mean ‘sub_document’?
  102 |             bsoncxx::document::value query = bsoncxx::builder::basic::make_document(kvp("_id", bsoncxx::oid(fileId)));
      |                                                                       ^~~~~~~~~~~~~

如何解决这个问题?

c++ mongodb gridfs mongo-cxx-driver
© www.soinside.com 2019 - 2024. All rights reserved.