C equivalent to mongo query db.users.find ({age {$ gt: 3}}, {})

I searched the use of conditional statements ( <, >, <=etc.) in the documentation API C link http://api.mongodb.org/c/current/ . But I can’t find him.

Example:

Mongo shell request

db.users.find({age: {$gt: 3}}, {})

I want an equivalent C statement for the above.

+5
source share
1 answer

For example, the query:

find({ age : { $gt : 5, $lt : 12}})

will be written as follows:

bson_init(&b);
bson_append_start_object(&b,"age");
bson_append_int(&b,"$gt",5);
bson_append_int(&b,"$lt",12);
bson_append_finish_object(&b);
bson_finish(&b);
+2
source

All Articles