I've got two questions that I cannot find an answer for in the tutorial.
I get a document and then an element from the doc like this:
bsoncxx::document::element e = doc["id"];
if (!e || e.type() != bsoncxx::type::k_int32) return…
I'm working with new c++11 mongoDB driver ( NOT the Legacy Driver ).
I'm trying to get the 'id' of a document in mongoDB after I inserted a new document. This ID is in the returned value 'retVal3'.
struct…
I installed the mongocxx driver, as shown by http://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/installation/ and
when I test driver everything looks fine, but if change a little code I get error while loading shared libraries:…
I am confused, in code snippets of online doc, it shows the usage of finalize when calling update_many method, like so:
mongocxx::stdx::optional result =
collection.update_many(
document{} << "i" << open_document <<
…
For example, if I do this in shell
> db.numbers.save( { name: "fibonacci", arr: [0, 1, 1, 2, 3, 5, 8, 13, 21] } )
Then i want to get arr in my c++ program.
After i got BSONObj i can get name with
std::string name = p.getStringField("name");
where…
I am tring to implement X.509 certificate authentication for Mongo using C++ driver. The driver is 3.4.0(custom build with enabled OpenSSL), C driver is 1.13.0, running on Debian 9, the server is Mongo 3.2
Code to connect:
…
I am trying to build mongo-cxx-driver in a CMake based project. This project is supposed to build on Windows, macOS and in an ubuntu container and I want to ensure that my software on all these platforms will use the same driver version so I cannot…
I am currently developing a C++ application which requires the use of the mongo-cxx-driver for accessing a MongoDB instance. I attempted a couple of methods of installation, and am met with the same linker issues each time.
Initially, I attempted to…
Do I have to manually lock mongocxx::pool while acquiring a connection?
i.e Is this safe? (example copied from Mongo website)
mongocxx::instance instance{};
mongocxx::pool pool {mongocxx::uri{}};
using mongocxx::pool::entry =…
Say, I inserted the following document using the mongo command line or shell:
db.Users.insert(
{
"user info":{
"user name" : "Joe",
"password" : "!@#%$%" ,
"Facebook" : "aaa",
"Google"…
When I'm using bsoncxx::to_json function to convert prepared bsoncxx document to json all float/double values are truncated to 5 digits precision. Please check following code:
#include
#include
#include…
In the mongocxx API, Collection.aggregate() expects a pipeline object in order to run an aggregate pipeline query. This means constructing the query by using the Pipeline class. Such as:
mongocxx::pipeline p{};
…