Total Page Preview:   000000100472

Like - Wildcard characters Search in Azure DocumentDB

In this article we will learn Like Search - wildcard charectore search - STARTSWITH or start charectore search - ENDWITH or end charectore search in azure documentdb.

Like or Wildcard charectore search:

The CONTAINS Method will Returns a Boolean indicating whether the first string expression contains the second.

Syntax

CONTAINS(<str_expr>, <str_expr>)

Example:

SELECT CONTAINS("brijesh", "h"), CONTAINS("brijesh", "p")

Result:
 
 [{"$1": true, "$2": false}]  
 
OUTPUT
 
 
Start With Search or STARTSWITH Method:
 
The STARTSWITH Method will Returns a Boolean indicating whether the first string expression starts with the second.
 

Syntax

STARTSWITH(<str_expr>, <str_expr>)

Example:

SELECT STARTSWITH("brijesh", "ri"), STARTSWITH("brijesh", "br")

Result:
 
 [{"$1": false, "$2": true}]  
 

OUTPUT

 
 
End With Search or ENDWITH Method:
 
The ENDWITH Method will Returns a Boolean indicating whether the first string expression ends with the second.
 

Syntax

ENDWITH(<str_expr>, <str_expr>)

Example:

SELECT ENDWITH("brijesh", "sh"), ENDWITH("brijesh", "es")

Result:
 
 [{"$1": true, "$2": false}]  
 

OUTPUT

 
 
 
Thanks,

Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com



Comments