Questions tagged [mongo-cxx-driver]

Officially supported C++ driver for MongoDB

The MongoDB C++ Driver is an officially supported driver for MongoDB. It is written in C++11. It wraps the MongoDB C Driver.

More information:

259 questions
1
vote
0 answers

Could not connect to mongo db replica set hosting on docker on Ubuntu using localhost

So, I am running my mongod replica set instances on docker. I am trying to establish the connection from my c++ application. Here is my docker-compose file. version: '3' services: api: hostname: api build: . ports: …
1
vote
1 answer

Mongocxx library segmentation fault

I'm trying to install the mongo-c-driver and mongo-cxx-driver in a Docker image, but when I run my C++ program it throws a Segmentation fault. Any ideas? Valgrind says it's mongo's fault. I have some IOT devices and in my own computer they run just…
1
vote
1 answer

mongo-cxx driver cannot find polyfill for unique_ptr

I'm trying to build mongo-cxx-driver on Windows; I'm following the instructions, but am getting errors: C1189 #error: "Cannot find a valid polyfill for make_unique" Here's what I did: Building mongo-c-driver I cloned mongo-c-driver using the…
nathan lachenmyer
  • 5,298
  • 8
  • 36
  • 57
1
vote
1 answer

Compiling with Mongo C++ driver returns undefined reference to `u_strFromUTF8_66'

I installed Mongo C++ Driver using following shell script, #!/bin/bash echo "Building MongoDB Core Dependency" cd /home && wget https://github.com/mongodb/mongo-c-driver/releases/download/1.17.0/mongo-c-driver-1.17.0.tar.gz && tar xzf…
user13599244
1
vote
0 answers

Mongocxx how to query array of documents

I want to query array consisting of documents according to "size" element. { "number": 0, "features": [{ "size": 10, "angle": 0.13546741008758545, "response": 0, }, { "size": 40, "angle": 0.3170666992664337, "response":…
1
vote
1 answer

How to get mongocxx gridfs id in format "bsoncxx::v_noabi::types::bson_value::view"

I am working with mongocxx 3.6.0 driver, I try to store and receive bytes from gridfs. I am able to run the example code in https://github.com/mongodb/mongo-cxx-driver/blob/releases/stable/examples/mongocxx/gridfs.cpp, but I want to search and get…
syvlvester
  • 61
  • 7
1
vote
1 answer

TLS Handshake failed when connecting to AWS DocumentDB using mongocxx C++

When trying to connect to AWS DocumentDB using mongocxx C++ driver, even after using the AWS combined pem file as a URI parameter (CA file), I get the below error of TLS handshake failed. No suitable servers found (`serverSelectionTryOnce` set):…
1
vote
1 answer

mongo c driver ./configure; no such file or directory

I am trying to install mongo-c-driver there follow by http://mongoc.org/libmongoc/1.14.0/installing.html. Snce I don't have the root permission, I ran the following: $ wget…
1
vote
1 answer

Different behaviour on mongo 4.0 and 4.2 using mongocxx 3.5

The following simple code exhibits different behaviour on mongo 4.2.6 and 4.0 #include #include #include #include #include #include…
Ghazanfar
  • 11
  • 3
1
vote
0 answers

mongo-cxx-driver decimal values problems

I'm using the mongocxx (v3) driver in my project to store the app settings in the mongodb. While working in windows everything seems to work well. But now that i'm testing in linux i have noticed some problems that i cannot understand why are…
Rui Sebastião
  • 855
  • 1
  • 18
  • 36
1
vote
1 answer

Get OID (types::b_oid) as string in MongoDB C++ driver

I'm using MongoDB C++ driver (version 3.4.0 for reference). I need to get the _id of a given document. First, I grab the document: bsoncxx::stdx::optional sub = conn["mydb"]["csubs"].find_one(...); so I can access to the…
fgalan
  • 11,732
  • 9
  • 46
  • 89
1
vote
1 answer

MongoDB building query with OR condition from an array

I want to create and run a query using MongoDB C++ api having these conditions : timestamp is within a range AND From an array of strings, atleast one of them to be equal to the type I have these fields in my MongoDB document: id_, timestamp,…
Anupam
  • 49
  • 8
1
vote
1 answer

How to read java unicode byte string encoded with utf-8 in c++

I have proto message which is stored in mongo as string with below syntax data.toByteString().toStringUtf8(); Which is nothing but unicode encoded as utf8. Now i am trying to read the same in c++ side from mongo using below - std::wstring…
1
vote
3 answers

How to write a bsoncxx::document::element to the console

I have the following function that gets a value out of a BSON document when given a sequence of keys: bsoncxx::document::element deepFieldAccess(bsoncxx::document::view bsonObj, const std::vector& path) { if (path.empty()) …
PlsWork
  • 1,958
  • 1
  • 19
  • 31
1
vote
1 answer

Query nested BSON documents with mongo c++ driver

I have a bsoncxx::document::view bsonObjViewand a std::vector path that represents keys to the value we are searching for in the BSON document (first key is top level, second key is depth 1, third key depth 2, etc). I'm trying to write…
PlsWork
  • 1,958
  • 1
  • 19
  • 31