mongoc_collection_aggregate documents:
pipeline: A bson_t, either a BSON array or a BSON document containing an array field named “pipeline”.
Constructing a BSON "array" requires constructing a BSON document with keys "0", "1", "2", ...
I think it's worth adding to the examples on that page an example of using this form pipeline, e.g. with:
pipeline = BCON_NEW ("[", "{", "$match", "{" "foo", BCON_UTF8("a"), "}", "}", "]");