Can we use LIKE
keyword to filter out records as we use in Sql Server
我们可以使用LIKE关键字过滤掉我们在Sql Server中使用的记录
1 个解决方案
#1
26
The keyword for LIKE
is CONTAINS
. If you had a document with a firstName
property and you wanted to filter on the name 'bob'
you would use it in a query this way:
LIKE的关键字是CONTAINS。如果您有一个带有firstName属性的文档,并且您想要对名称'bob'进行过滤,那么您将在查询中使用它:
"SELECT * FROM c WHERE CONTAINS(c.firstName, 'bob')"
“SELECT * FROM c WHERE CONTAINS(c.firstName,'bob')”
Or if you were using Linq
and assuming you had a class Person
with a FirstName
property the same query would work this way:
或者,如果您使用Linq并假设您有一个具有FirstName属性的Person,则相同的查询将以这种方式工作:
var dbClient = GetClient();
var docs = dbClient.CreateDocumentQuery<Person>(Collection)
.Where(p => p.FirstName.Contains("bob");
#1
26
The keyword for LIKE
is CONTAINS
. If you had a document with a firstName
property and you wanted to filter on the name 'bob'
you would use it in a query this way:
LIKE的关键字是CONTAINS。如果您有一个带有firstName属性的文档,并且您想要对名称'bob'进行过滤,那么您将在查询中使用它:
"SELECT * FROM c WHERE CONTAINS(c.firstName, 'bob')"
“SELECT * FROM c WHERE CONTAINS(c.firstName,'bob')”
Or if you were using Linq
and assuming you had a class Person
with a FirstName
property the same query would work this way:
或者,如果您使用Linq并假设您有一个具有FirstName属性的Person,则相同的查询将以这种方式工作:
var dbClient = GetClient();
var docs = dbClient.CreateDocumentQuery<Person>(Collection)
.Where(p => p.FirstName.Contains("bob");