How do you do SQL Like operator in mongoDB using the official C# driver

匆匆过客 提交于 2019-12-08 11:13:23

问题


How do you do the following SQL query in mongodb using the official c# Driver?

Select * from tblUser where FirstName Like '%as%'

回答1:


I figured out how to do this. You have to use Query.Matches

var query = Query.Matches("FirstName", ".*as.*");



回答2:


I'd suggest you visit this site. It has a wealth of material on the official C# driver from 10gen.

http://www.mongodb.org/display/DOCS/CSharp+Driver+Tutorial

Most answer will just reproduce what is available on the link above. If you have a specific question about problems you are having after the tutorial, please ask a more specific question.



来源:https://stackoverflow.com/questions/5709644/how-do-you-do-sql-like-operator-in-mongodb-using-the-official-c-sharp-driver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!