i am using official mongodb c# driver. i want to query mongodb simliar to SQL Like something like db.users.find({name:/Joe/}
in c# driver
The MongoDB C Driver, also known as “libmongoc”, is a library for using MongoDB from C applications, and for writing MongoDB drivers in higher-level languages. It depends on libbson to generate and parse BSON documents, the native data format of MongoDB.
Welcome to the documentation site for the official MongoDB C++ driver. You can add the driver to your application to work with MongoDB using the C++11 or later standard.
By developing with C# and MongoDB together one opens up a world of possibilities. Console, window, and web applications are all possible. As are cross-platform mobile applications using the Xamarin framework.
c# query will looks like:
Query.Matches("name", BsonRegularExpression.Create(new Regex("Joe")));
As per @RoberStam suggestion, there is more simple way to do this:
Query.Matches("name", "Joe")
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