Search code examples
mongo-c-driver

Regex in MongoC


How can I do this query in mongoC with bcon_new?

 db.users.find({"name": /.*m.*/})

Solution

  • 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") );