Home > Software engineering >  How use IS_DEFINED cosmos db function in CreateDocumentQuery method of DocumentClient class?
How use IS_DEFINED cosmos db function in CreateDocumentQuery method of DocumentClient class?

Time:01-21

Normally, I do

var query = client.CreateDocumentQuery<Customer>(collectionUri, feedOptions)
             .Where(u => c.orderdate != null).AsDocumentQuery();

Here is the Azure Cosmos db query with in-built Type checking function,

"Select * from c where not IS_DEFINED(c.middlename) order by c.firstname"

I want to use the above query in Azure function app as part of DocumentClient.CreateDocumentQuery(), how to do it?

 // as you know syntactical error with below code, how to overcome?

 var query = client.CreateDocumentQuery<User>(collectionUri, feedoptions)
.Where(u => NOT IS_DEFINED(u.orderid));

or

What are the other ways to use the above 'select' query as such in Azure function app along with feedoptions?

one of the ways to use sql query as such in the Azure function app is,

 public static async Task<IActionResult> Run(
        [HttpTrigger(AuthorizationLevel.Function, "get")] HttpRequest req,   
        [CosmosDB(databaseName: "           
  •  Tags:  
  • Related