How can I do this query in mongoC with bcon_new?
db.users.find({"name": /.*m.*/})
MongoDB provides the functionality to search a pattern in a string during a query by writing a regular expression. A regular expression is a generalized way to match patterns with sequences of characters. MongoDB uses Perl compatible regular expressions(PCRE) version 8.42 along with UTF-8 support.
Using $regex operator for Pattern matching The regex operator in MongoDB is used to search for specific strings in the collection.
After few try and error i finally found the answer based on libbson analogy
bson_t *query;
query = BCON_NEW ("name", BCON_REGEX("m","i") );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With