Does DocumentDB support the LIKE keyword in queries?

12,667

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:

"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:

 var dbClient = GetClient();
 var docs = dbClient.CreateDocumentQuery<Person>(Collection)
                    .Where(p => p.FirstName.Contains("bob");
Share:
12,667
Joker_37
Author by

Joker_37

Updated on June 03, 2022

Comments

  • Joker_37
    Joker_37 about 2 years

    Can we use the LIKE keyword to filter out records as we use it in T-SQL?