我正在使用官方的 mongodb c# 驱动程序。
我想查询类似于 SQL Like 的 mongodb
类似于 c# 驱动程序中的 db.users.find({name:/Joe/}
最佳答案
c# 查询将如下所示:
Query.Matches("name", BsonRegularExpression.Create(new Regex("Joe")));
更新:
根据@RoberStam 的建议,有更简单的方法可以做到这一点:
Query.Matches("name", "Joe")
关于c# - MongoDB C# 查询字符串上的 'Like',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8382307/