All Questions
138 questions
2
votes
1
answer
55
views
Why is the demo program for MongoDB throwing a warning before exiting?
I am following the tutorial for MongoDB's C driver. This is the demo (hello database) program:
#include <mongoc/mongoc.h>
int main(void) {
mongoc_client_t *client = NULL;
bson_error_t ...
2
votes
0
answers
60
views
Node.js FFI-NAPI: TypeError - writePointer: Buffer instance expected
I’m using ffi-napi and ref-napi in Node.js to call a C function, but I encountered the following error:
TypeError: error setting argument 3 - writePointer: Buffer instance expected as third argument
...
1
vote
0
answers
61
views
vcpkg:mongo-c-driver[openssl]:arm64-ios-release build failure
build on macos14 with github actions.
I don’t know why it failed to compile. I tried it in the actions of github. I haven’t modified anything else and vcpkg is also the latest.
yml code is:
name: ios ...
2
votes
1
answer
101
views
How to append a document/object to an existing bson_t array using libbson C API
I have a JSON string I know it is a JSON object e.g.
char* jsonObjStr = "{ \"Name\" : \"Obj_1\" }";
and another JSON string I know it is a JSON array e.g.
char* ...
1
vote
1
answer
79
views
Implementing a system assigned key in Mongo
We are using libbson mongo-c-driver version 1.15.0, and trying to convert database files from DISAM to Mongo. The code uses system assigned keys (sak) for records in some tables - which are numbers in ...
0
votes
1
answer
52
views
MongoDB Transaction using mongo driver
bool
create_and_insert_doc (mongoc_client_session_t *session,
void *ctx,
bson_t **reply, /* out param for our server reply */
...
1
vote
0
answers
55
views
How to find the id of document inserted using mongoc_collection_insert_one in mongo-c-driver
I am using the mongo-c-driver, I want to get the id of the document inserted via mongoc_collection_insert_one.
if (!mongoc_collection_insert_one (collection, insert, NULL, &reply, &error)) {
...
1
vote
0
answers
26
views
How to get number of documents returned in a cursor from a query in mongodb in C?
I am looking for a good way to get the number of documents returned by a query to mongodb in C language.
I am looking for something what cursor.count() does in python. But cannot find anything that ...
0
votes
0
answers
99
views
Build mongo-c-driver for 32bit
How to build mongo-c-driver for 32bit linux on a 64bit linux machine using cmake? I'm trying to build it with -DCMAKE_TOOLCHAIN_FILE and all packages are installed with i386.
Error when trying to ...
0
votes
0
answers
140
views
How to get bson_t* subdocument from bson_iter_t using C API
I am using mongoc and associated BSON library for reading and writing to a disk file. I'm having trouble understanding the BSON C API. This is for an acceptance test where I have expected results ...
2
votes
1
answer
525
views
Why BSON is not using uint32_t instead of int32_t for document lenght
According to BSON specification an int32_t is used for the total number of bytes comprising the document.
I can also see that mongo-c-driver is using Libbson and it's using int32_t.
But what is the ...
1
vote
0
answers
1k
views
fatal error: bson/bson.h: No such file or directory
I want to use libmongoc for my C program but whenever I try to establish a connection to my cloud database, it shows an error:
/usr/local/include/libmongoc-1.0/mongoc/mongoc.h:22:10: fatal error: bson/...
1
vote
1
answer
868
views
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/...
0
votes
1
answer
100
views
How to Query in MongoDB using one Key in c
I am attempting to search for a key's value in MongoDB via my .c program. essentially In my collection in one of my documents: I have key:value, i want to be able to return said value by passing in ...
1
vote
1
answer
691
views
MongoDB c Driver extracting arrays from bson
I am attempting to extract an array from a MongoDB document using the c driver.
The document is structured like this:
name: "TestName"
data:["testData1","testData2"];
I have retrieved the document ...