小编Sam*_*ali的帖子

Mongodb C++ 正则表达式查询

如何在 C++ 中使用正则表达式查询 MongoDB 数据库。

mongo-cxx-driver-r3.1.1

听到包括

#include <cstdlib>
#include <iostream>
#include <bsoncxx/builder/stream/document.hpp>
#include <bsoncxx/json.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/instance.hpp>
#include <mongocxx/uri.hpp>
#include <cstdint>
#include <vector>
#include <mongocxx/stdx.hpp>
#include <bson.h>
#include <conio.h> 
#include <sstream> 
#include <stdio.h> 
#include <string>
#include <bsoncxx/types.hpp>
#include <mongocxx/exception/exception.hpp>
#include <bsoncxx/builder/basic/document.hpp>
#include <bsoncxx/builder/basic/kvp.hpp>

using bsoncxx::builder::stream::close_document;
using bsoncxx::builder::stream::document;
using bsoncxx::builder::stream::finalize;
using bsoncxx::builder::stream::open_document;
using bsoncxx::builder::basic::kvp;
using bsoncxx::builder::basic::make_document;
Run Code Online (Sandbox Code Playgroud)

这是我尝试过的。

  void MyClass::on_querybtn_clicked()
   {

auto collection = conn["TestDB"]["fdevices"];
bsoncxx::types::b_regex::b_regex();//i am lost here dont know how to use it
auto cursor = collection.find({});

 for …
Run Code Online (Sandbox Code Playgroud)

c++ regex mongodb mongo-cxx-driver

5
推荐指数
1
解决办法
697
查看次数

标签 统计

c++ ×1

mongo-cxx-driver ×1

mongodb ×1

regex ×1