note that since this is partially a query question if you need more help you may get more replies on the mongodb_user google group...
you may have already viewed has info:
for somehting like this json:
{
$or: [
{ _id : 123 },
{ $and : [ { name:"abc" }, { age:33 } ] }
]
}
i believe it would be something like
bsoncxx::builder::stream::document b;
b <<
"$or" << open_array <<
open_document << "_id" << 123 << close_document <<
open_document <<
"$and" << open_array <<
open_document << "name" << "abc" << close_document <<
open_document << "age" << 33 << close_document <<
close_document <<
close_array <<
close_array;
auto cursor = db["mydb"].find(b.view());
i believe the cleanup is automatic when 'b' above destructs.
if above seems verbose you could make local shorthands within a given function or file scope e.g.:
auto &open_document_type D = open_document;
auto &open_document_type D_ = close_document;
see also
and browse around there perhaps?