bsoncxx::builder::stream::document search_builder;
mongocxx::options::find img_find; // This speeds up the queries
search_builder_images.clear();
search_builder_images << "_id" << "abc" << "data" << open_document <<"$exists" << true << close_document ;
for (bsoncxx::document::view doc : cursor_cal) {
std::cout << bsoncxx::to_json(doc) << std::endl;
}
auto cursor_cal = dbMongo[collectionName].find(search_builder.view());
这里随机有 50-50% 的机会,有时我得到我期望的输出,有时我得到分段错误错误。
我究竟做错了什么 ?(我正在尝试创建此 search_builder 以在 mongodb 数据库中搜索并获取存在数据的文档?)