Questions tagged [mongo-c-driver]

Officially supported C Driver for MongoDB

MongoDB C Driver is an officially supported driver for MongoDB. It is written in pure C.

More information:

126 questions
0
votes
1 answer

Assert failed in mongoc library

I'm using mongoc library in ANSI C code. I'm new with mongoc API and I have problem in creating query. Following code throws assertion src/bson/bcon.c:807: bcon_append_ctx_va: Assertion `ctx->n != 0' failed. Can someone help? bool…
ah laht
  • 1
  • 2
0
votes
0 answers

When using libmongoc i get a segfault at `client = mongoc_client_new ("mongodb://localhost:27017");`

When I try to use libmongoc, I get a segfault at client = mongoc_client_new ("mongodb://localhost:27017"); GDB results: Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7970d79 in _mongoc_client_new_from_uri () from…
0
votes
0 answers

MongoDB: bulk operations that do not match

I am using MongoDB with the c-client, mongoc 1.8.1. I am performing a bulk update, with 6 mongoc_bulk_operation_update_one() operations. However, for 3 of the updates the selection document does not match anything in the database (say…
YTock
  • 1
  • 1
0
votes
2 answers

Testing mongocxx c++ driver with a sample code

I'm trying to connect mongdb with mongocxx driver in my C++ sample code. I added Additional include, Libraries and dependencies. When I build it it shows following error. this is the full code #include "stdafx.h" #include #include…
Nwn
  • 561
  • 2
  • 9
  • 33
0
votes
1 answer

MongoDB C Driver: How to replace a document

How can we replace a document in MongoDB using Mongo C Driver? Are there any APIs available?. In Mongo shell I can use replaceOne for this purpose. But how can I do this through my C program?
Arun KS
  • 95
  • 1
  • 5
0
votes
1 answer

nesting $pull commands in Mongo

I am attempting to remove a value from multiple arrays without having to issue multiple Mongo commands. I must have my syntax incorrect, any help would be appreciated. When I try: update = BCON_NEW("$pull", "{", …
Steven Carlson
  • 925
  • 1
  • 10
  • 25
0
votes
1 answer

Compile mongo-c-driver

I'am trying to compile mongo-c-driver from this link regarding to described in this link. I have compiled libbson successfulty, when i try to below command I get The source directory "/" does not appear to contain CMakeLists.txt. cmake -G "Visual…
Enes Köroğlu
  • 184
  • 5
  • 15
0
votes
0 answers

How to threat bson_destroy() on an uninitialized bson_t variable

I have a following code: bool ok; bson_t * query = bson_new(); BSON_APPEND_BINARY(query, "_id", BSON_SUBTYPE_BINARY, client_id, CLIENT_ID_SIZE); bson_t * update = bson_new(); bson_t update_ch1; BSON_APPEND_DOCUMENT_BEGIN(update, "$set",…
Ales Teska
  • 1,198
  • 1
  • 17
  • 38
0
votes
0 answers

mongoc driver how to authenticate

I am having trouble with correct format of authenticating code. According to http://mongoc.org/libmongoc/current/authentication.html, authenticate code is mongoc_client_t *client = mongoc_client_new…
dome some
  • 479
  • 7
  • 22
0
votes
3 answers

Get a document with a specific _id with mongo-delphi-driver

I have to perform a query on mongodb, i would like select only a document has a particular _id (type ObjectId). I use "Strict mode" sintax and in particular the operator $oid for compare _id with a string. But it doesn't work!, I don't now if it is…
Marco Andreolli
  • 316
  • 5
  • 19
0
votes
0 answers

mongodb and ubuntu server keeps crashing

I have a C script that parse some data and put the data into mongodb using mongoc driver. The script use multithreading to open 3 threads at the same time. The very first time it worked without problem, but somehow I lost data and had to rerun the…
dome some
  • 479
  • 7
  • 22
0
votes
0 answers

Getting segmentation fault when not specifying PEM file fo SSL

I'm using monoc 1.2.0 successfully, I'm now trying to add an SSL enabled connection in a two of modes: Only require SSL no certificate check Provide certificate and verify it including hostname For 1 I get segmentation fault: #0 0x00002ac83368e3c8…
sagioto
  • 251
  • 1
  • 5
  • 16
0
votes
1 answer

thread safe for different collections in mongo_c_driver

I want to do bulk insert for many threads at the same time, each time each thread insert data into different collections. I know it's not thread safe if I put all data into one collection, but what if each thread insert data into a totally different…
0
votes
1 answer

Using MongoDb c driver to extract array from bson

I have documents in a mongo collection which look like: { "f" : [ 283, 180, 284 ], "l":["1","29"] } I am using the mongoDB c driver to fetch these documents and perform some operations on these> I would like to restore element "f" back as an array…
Terminator
  • 117
  • 1
  • 12
0
votes
0 answers

MongoDB C driver how to find object field value in array of objects

i try to find way in C Driver to somthing that is similar to : https://docs.mongodb.com/manual/reference/operator/query/elemMatch/#op._S_elemMatch as answerd in this thread : Query for a field in an object in array with Mongo? i have this json and…
user63898
  • 29,839
  • 85
  • 272
  • 514
1 2 3
8
9