Questions tagged [mongodb-c]

The MongoDB C Driver is the officially supported driver for MongoDB. It is written in C89 compatible C.

MongoDB C Driver is a client library written in C for MongoDB.

For the official MongoDB C documentation, go to http://mongoc.org/libmongoc/current/index.html

47 questions
0
votes
1 answer

Retrieve all data in collection in new MongoDB-C driver

I have a very simple question in appearance but for which I've been stuck for several days. What method would you consider (the most effective one, if you know several) to retrieve all the data present in a collection ? Here's the structure of my…
John S
  • 231
  • 3
  • 11
0
votes
1 answer

mongodb c++ replica set getScopedDbConnection crash

I'm having troubles connecting to replica set from my c++ application. Everything is fine if connecting to single mongo instance. But the application crashes if trying to connect to replica set. "Crashes" means that the process just disappears after…
Vasyl
  • 75
  • 9
0
votes
1 answer

How to find specific value in MongoDB-C driver

When my structure looks like this: X: { Y: "blabla" } So I use the function "bson_iter_find_descendant(&iter, "X.Y", &desc)" to recover my data. But how to retrieve the values of "X.Y", "X.Z"... when my structure looks like this: X: [ { …
John S
  • 231
  • 3
  • 11
0
votes
1 answer

Complex query with two $OrderBy

Here's the structure part of my collection : by: [ { id: ObjectId("XX"), type: NumberInt(1) } ], timestamp: NumberInt(), // is timestamp 1 status: NumberInt(0), mails: [ { id: ObjectId("YY"), text: "", …
John S
  • 231
  • 3
  • 11
0
votes
0 answers

MongoDB C Driver (UTF-8 ?)

I have a problem of inclusion for special characters in my database (accents or Russian alphabet for example). They become unreadable/unrecoverable or create some bugs in my database. eg. "étudier" become "tudier" / or "Наталья" will display " …
John S
  • 231
  • 3
  • 11
0
votes
0 answers

Mixing Boost versions in linked libraries

I'm have an application, which uses Boost and uses the MongoDB Cxx driver 2.2 (which has to use Boost 1.48 because of Boost Filesystem v2) in a statically linked library. Now I want to upgrade the Boost version for the application to 1.54 to use…
Simon
  • 1,616
  • 2
  • 17
  • 39
0
votes
1 answer

Mongo_count for sub-documents in mongodb C driver

Here's the structure part of my collection : { ... list: [ { id:'00A', name:'None 1' }, { id:'00B', name:'None 2' }, ], ... } After having used the function "distinct" (see the link : sub-object in sub-array in…
John S
  • 231
  • 3
  • 11
0
votes
1 answer

sub-object in sub-array in mongodb-C

Here's the structure part of my collection : { ... list: [ { id:'00A', name:'None 1' }, { id:'00B', name:'None 2' }, ], ... } Which method could you advise me to retrieve the list of values in the "id" and/or "name" field…
John S
  • 231
  • 3
  • 11
0
votes
1 answer

Use list in mongodb C driver

Here's the structure part of my collection : { ... likes: ['6a6ca923517f304900badd98','6a6ca923517f304900badd99','...'], ... } Which method could you advise me to retrieve the list of values in the "likes" field with C lib please ?
John S
  • 231
  • 3
  • 11
0
votes
1 answer

sub iterator object in mongodb C driver

Here's the structure part of my collection : { _id: { id:"6a6ca923517f304900badd98", target:"00badd6a6ca923517f304998e4df" }, ... } The use of : if(bson_find(iterator, mongo_cursor_bson(cursor), "_id")){ …
John S
  • 231
  • 3
  • 11
0
votes
2 answers

$exists query in mongodb c-api

I am trying to implement the following mongodb query in C db.test.find({"timestamp": {"$exists":true}}); I thought it would be something like bson query, existspart; mongo_cursor cursor; int i; bson_init(&existspart); bson_append_string (…
user2451275
0
votes
0 answers

MongoDB-C and BSON

I wonder if it's possible to retrieve the content of a MongoDB collection under the BSON format ? That is to say retrieve a result like {"name" : "John","age" : 24} in the "tutorial.persons" collection when the field _id is equal to "1" for…
John S
  • 231
  • 3
  • 11
0
votes
1 answer

Trying to get the MongoDB driver working in Visual Studio 2010 C++

MongoDB driver for C++ is unbelievably complicated to work with. I want to make a simple C++ project that inserts a row to my MongoDB instance. I need it in a x64 ENV and in VS2010 IDE. Do you guys maybe have the binaries of the driver or a simple…
max2005b
  • 353
  • 1
  • 2
  • 9
0
votes
1 answer

How to reconnect to replica set when primary node crash?

In this simple program, I want to reconnect to replica set when the primary node crash. But it doesn't work: if the primary node crash, this program will be terminated immediately without any output, and return 141. I don't know why. What is the…
user805627
  • 4,247
  • 6
  • 32
  • 43
0
votes
2 answers

MongoDB C++ driver -- Passing Query object by reference raises error when subsequently using its sort

Windows 7 64 SP1 -- MongoDB 2.2.0-rc2 -- Boost 1.42 -- MS VS 2010 Ultimate -- C++ driver I've written this function: void printQuery(DBClientConnection &c, std::string &dc, const Query &qu = BSONObj(), std::string sortby = "" ) This…
Therefore
  • 367
  • 2
  • 13