how to use $or with C driver?

107 views
Skip to first unread message

Álvaro Izquierdo

unread,
Oct 20, 2011, 6:08:04 AM10/20/11
to mongodb-user
Hi!!

I would like to test the $or in C without bson_buffer. May somebody
send an example?

Many thanks in advanced and best regards,
Álvaro

Álvaro Izquierdo

unread,
Oct 20, 2011, 6:36:48 AM10/20/11
to mongodb-user
Own answer....

bson_init( &b );
{
bson_append_start_array( &b , "$or" );
bson_append_start_object( &b, "0");
bson_append_int( &b, "a", 4 );
bson_append_finish_object( &b );
bson_append_start_object( &b, "1");
bson_append_int( &b, "a", 2 );
bson_append_finish_object( &b );
bson_append_finish_object( &b );

}
bson_finish( &b );

Many thanks,
Álvaro.
Reply all
Reply to author
Forward
0 new messages