如何使用条件操作符在mongodb查询在c++
How to use conditional operators in mongodb queries in c++
当使用MongoDB c++ 驱动程序时,我找不到如何在查询中使用条件运算符("$in", "$gt", "$lt"...)
?
javascript实现示例:
db.collection.find( { field : { $in : array } } );
db.collection.find( { "field" : { $gt: value1, $lt: value2 } } );
编辑:c++文档回答了$gt/$lt操作符,但没有提到$in:
也许我误解了,但你问题中的链接实际上确实给出了一个例子。表中的第六个条目显示了javascript和c++驱动程序之间的以下关系:
Javascriptdb.users.find({'age':{$gt:33},{$lte:40}})
c++ auto_ptr<DBClientCursor> cursor =
c.query("mydb.users", QUERY("age"<<GT<<33<<LTE<<40));
相关文章:
- Mongodb c++驱动程序:如何查询元素的数组
- Mongocxx无法使用SSL连接到mongoDB
- 获取 OID(类型::b_oid)作为 MongoDB C++驱动程序中的字符串
- MongoDB 使用数组中的 OR 条件构建查询
- 使用 C++ 查询 MongoDB 的日期字符串
- MongoDB C++ 驱动程序 - 8 位和 16 位整数?
- 无法使用C++代码向MongoDB进行身份验证
- 将 MongoDB C++ 驱动程序升级到 mongocxx-3.1.2
- Mongodb C驱动程序在Windows上安装失败
- 修改Mongodb源代码以禁用文档的自动生成"_id"字段
- Mongodb C++编译问题
- Mongodb Cxx 驱动程序测试在发布版本中崩溃 [ 在调试中工作正常]
- 在 mongodb c++ 驱动程序中使用声明"not found"
- 将mongocxx连接到mongodb服务器时出错:SSL支持不可用
- MongoDB C 查询文档的子元素
- 编译MongoDB C 11驱动程序的错误
- C++ MongoDB 客户端作为类成员
- 无法从C++代码连接到MongoDB
- 如何在C++中使用MongoDB GeoSpatial Index
- Mongodb C++ API 插入二进制文件(图像)