I would like to perform an update using an aggregation pipeline with libmongoc, but it appears that libbson precludes this possibility.
Here’s a simple example from the mongo shell:
db.stuff.update(
{“name”: “thing”},
[
{“$set”:
{“notes”:
{“$concat”: [“$notes”, “ more notes.”]}
}
}
]
)
mongoc_collection_update_one() — libmongoc 1.23.2 states the following:
*update: A bson_t containing the update to perform. If updating with a pipeline, a bson_t array.
A bson_t “array”, however, appears to always have a key, and having a key here does not work. I have not been able to determine how to create a bson_t which consists of, for example, [{“$set”:{“notes”:{“$concat”:[“$notes”,“ more notes.”]}}}]
Am I missing something, or is this not possible and the documentation wrong?