Can we use the LIKE
keyword to filter out records as we use it in T-SQL?
UPDATE : You can now use the LIKE keyword to do text searches in Azure Cosmos DB SQL (core) API! (i) Currently Azure Cosmosdb supports the CONTAINS , STARTSWITH , and ENDSWITH built-in functions which are equivalent to LIKE. The keyword for LIKE in Cosmosdb is Contains .
Azure Cosmos DB is the next big leap in globally distributed, at scale, cloud databases. As a DocumentDB customer, you now have access to the new breakthrough system and capabilities offered by Azure Cosmos DB.
Amazon DocumentDB (with MongoDB compatibility) is a fast, scalable, highly-available, and fully managed document database service that supports MongoDB workloads. Amazon DocumentDB is compatible with the MongoDB 3.6 and 4.0 APIs. This section lists the supported functionality.
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");
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