问题标签 [mongo-cxx-driver]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c++ - 在 c++ r3.0.2 驱动程序中使用连接池连接到 mongodb 副本集的正确方法是什么?
我正在将我的 mongodb c++ 客户端代码从旧版驱动程序和 26compat 驱动程序升级到 r3.0.2 驱动程序。现在删除了作用域连接池类。我的问题是如何使用连接池连接到副本集。我目前的代码是:
使用默认的最大池大小 100 值。但我不知道我的方式是否正确?
c++ - MongoDB C++, How to add ISODate value when inserting
This is about the new MongoDB C++ Driver (not the legacy one). I can insert a document this way:
The above code insert a document with 1 field 'Key' of value 'Value'. I can insert string, int, float,... but just can't figure out how to insert ISODate. The new MongoDB C++ Driver should come with more examples in documentation.
c++ - 如何使用 mongo-cxx-driver 设置 Visual Studio 项目设置?
我已经成功地在 Windows 10 上为 C++ 构建了 MongoDB 驱动程序的 3.0.3 版本
CMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver
但我不知道如何在 Visual Studio 2015 中设置可以使用此驱动程序的项目。
我在这里找到了这篇文章,但我不明白确切的解决方案。我尝试了以下属性但失败了:
- C/C++ > 附加包含目录:C:\mongo-c-driver\include\libbson-1.0;C:\mongo-c-driver\include\libmongoc-1.0;C:\mongo-cxx-driver\include\bsoncxx \v_noabi;C:\mongo-cxx-driver\include\mongocxx\v_noabi;%(AdditionalIncludeDirectories)
- 链接器 > 附加库目录:C:\mongo-cxx-driver\lib;%(AdditionalLibraryDirectories)
Visual Studio doesn't mark any errors, but when I try to compile the code, I get 401 errors.
I hope someone can help me.
EDIT: The complete list of all 401 errors is stored here.
EDIT: I startet a new project and used exactly the same settings. Now I just get 14 errors. The list of errors is stored here (EDIT: removed file).
EDIT: I added the following configuration:
- Configuration Manager > Active Solution Platform: x64
- C/C++ > Additional Include Directories: C:\Program Files\boost\boost_1_62_0;
Now I get the following errors.
mongodb - mongo-cxx-driver 加倍为 json
在尝试使用 MongoDB 的 C++11 驱动程序(版本 3.1.0-rc0)时,以下代码的输出让我感到困惑。
输出:
- 这是预期的行为吗?
- 如何确保 BSON 双精度在 JSON 中表示为浮点数?
配置: CentOS 7、gcc 6.2.0、mongo-c-driver 1.5.0、mongo-cxx-driver 3.1.0-rc0
c++ - 使用 MongoDB C++ 驱动程序在 BSON 文档中查找
我的 MongoDB 测试数据库中有以下文档:
我需要找到 => 1 和 <= 2 的级别,你能帮帮我吗?可以用mongocxx吗?
c++ - 使用 MongoDB C++ 驱动程序在 BSON 文档中查找
我的 MongoDB 测试数据库中有以下文档:
我需要找到 Builds level >=2 and <= 5 and abs status >=5 it like if(builds.leve >=2 && builds.level <= 5 && abs.status >=5 && abs.level>=2)多个条件,需要取值大小你能帮我吗?
regex - 如何使用 mongocxx 在 mongoDB 查询中发送正则表达式?
以下是我尝试使用 mongocxx 驱动程序查询 mongodb 的一段代码。
/*查找所有匹配过滤器的代码*/
这里
Vehicle_Registration、Vehicle_Make、Vehicle_Model、Vehicle_Owner
是集合的字段。
的价值
vReg、vMake、vModel、vOwner
由用户在屏幕上指定。如果用户只指定了这些值中的一部分(不是全部),则其余值保持为 NULL。为了避免搜索 NULL 值,我尝试将它们设置为正则表达式 { $regex: /./ } 以便 NULL 值不会影响搜索。
此正则表达式适用于 mongo shell,设置为此正则表达式的所有字段都将被忽略并且不影响搜索。
但是在代码中,要设置这个正则表达式,我会这样做:
然后在 document{} 中传递 vReg,如顶部代码所示
这里 vReg 作为字符串"{ $regex: /./ }"
(带引号)而不是{ $regex: /./ }
(不带引号)传递。因此,它被认为是一个字符串,而不是在查询中作为正则表达式进行评估,因此没有搜索结果。
有人可以帮我知道如何将它作为正则表达式传递吗?
谢谢!
c++ - MongoCxx 3.1.0 如何关闭连接?
我的程序可能连接很少,我需要关闭每个连接。请帮帮我。
conn.close() 或者我该如何关闭它?
c++ - Mongo C++ 批量操作
如何使用新的 Mongocxx 驱动程序执行批量操作?司机手册太可怕了。而且任何地方都没有例子!!!
相关类: http: //mongodb.github.io/mongo-cxx-driver/api/mongocxx-3.1.1/classmongocxx_1_1bulk__write.html
我可以使用创建操作bulk_write::bulk_write()
并使用添加查询bulk_write::append()
。但我对如何执行它感到困惑。
可怕的是他们没有像 mongo shell 那样提供类似的功能。例如:https ://docs.mongodb.com/manual/reference/method/Bulk/
c++ - MongoDB C++:mongocxx::pool 线程安全吗?
获取连接时是否必须手动锁定 mongocxx::pool?
即这是安全的吗?(从 Mongo 网站复制的示例)