I have a collection named example_Collection with data of format:
{
{
"_id": ObjectId("100"),
"source_timestamp":{
"sec" : 90000
}
}
{
"_id": ObjectId("200"),
"source_timestamp":{
"sec" : 95000
}
{
"_id": ObjectId("300"),
…
Looking at the functions used in the Mongo C driver to do operations on collections, I see that many of them use a bson_error_t* return parameter to get possible errors (and they return false in that case).
For instance…
I have this program in C (a slight variation of the hello world example at Mongo C driver documentation:
#include
#include
#include
// file insert.c
// compiled with: gcc -o insert insert.c $(pkg-config…
I'm trying to build a program using the Mongo C driver. My CMake configuration includes this:
include_directories("/usr/local/include/libmongoc-1.0")
include_directories("/usr/local/include/libbson-1.0")
...
SET (STATIC_LIBS
...
…
I wrote some basic funtions that uses mongodb-c-driver. and I tried to write some tests with GTest.
in each test case I init and destroy mongoc with ( mongoc_init() and mongoc_cleanup()).
When I run one test case, everything goes fine but when I run…
I am trying to build a mongocxx c driver with the latest release. I am doing this with minGW makefiles and am using cmake-gui.
My configuration for cmake is:
Source input:
C:/****/mongo-c-driver-1.17.3/build
Build…
I'm trying to add a TTL index in my mongodb with mongoc lib http://mongoc.org/.
What I'm doing is :
keys = BCON_NEW("createdAt", BCON_INT32(1), "expireAfterSeconds", BCON_INT32(30));
index_name =…
Counting the number of documents in a collection is easy and fast (apparently constant time) in the shell.
> db.my_collection.count()
12345678
>
In C++ I try this:
mongocxx::client client;
mongocxx::database db = MongoInit(client,…
I am completely mystified (and supremely frustrated). How do I create this call using the mongoc library?
I have the following doc structure in the collection
{_id: myOID,
subsriptions: {
newProducts: true,
newBlogPosts: true,
…
I'm struggling to get a valid conversion of my qstring to whatever kvp needs inside mongo...
I tried
std::string_view k(documentKey.toStdString().c_str());//, documentKey.size()); // tried adding size as wll
std::string_view…
I'm stuck in something very stupid but I can't get out from my own.
MongoDB v4.2 and I have a collection with documents like this:
{"_id":{"A":"***","B":0}}, "some other fields"...
I'm working on top of mongo-c driver and I want to query only the…
The mongoc documentation for transaction uses session. So I tried to insert documents within a transaction associated with a session. But I got the error
[ 3666]: ERROR: mongoc: Failed to start session: Server does not support sessions
How…
I have a program compiled and running on Ubuntu server 16.04, in C using Mongo C driver. This works without a problem. If I move this executable to a new installation, I get an error when executing;
testuser@usrv1604:~/bin$…
When I run the hello_mongoc test app (renamed to mongotest), the output looks like this:
{ "ok" : 1 }
./mongotest: symbol lookup error: /usr/local/lib/libmongoc-1.0.so.0: undefined symbol: bson_validate_with_error
The app is build with:
cc -o…
Following are snippets of my code in C, redacted for ease of reading:
bCursor = mongoc_collection_find_with_opts(...);
mongoc_cursor_next(bCursor, &bDoc);
where I get the document in bDoc as json:
{
"_id" : { "$numberInt" : "4184300" },
…