如何在DocumentClient class的CreateDocumentQuery方法中使用IS_DEFINED cosmos db函数?
How use IS_DEFINED cosmos db function in CreateDocumentQuery method of DocumentClient class?
通常我会
var query = client.CreateDocumentQuery<Customer>(collectionUri, feedOptions)
.Where(u => c.orderdate != null).AsDocumentQuery();
这是带有内置类型检查功能的 Azure Cosmos 数据库查询,
"Select * from c where not IS_DEFINED(c.middlename) order by c.firstname"
我想在 Azure 函数应用程序中使用上述查询作为 DocumentClient.CreateDocumentQuery() 的一部分,该怎么做?
// 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));
或
还有哪些其他方法可以在 Azure 函数应用程序中使用上述 'select' 查询以及 feedoptions?
在 Azure 函数应用程序中使用 sql 查询的方法之一是,
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get")] HttpRequest req,
[CosmosDB(databaseName: "%dbName%",
collectionName: "%collection%",
SqlQuery ="Select * from c",
ConnectionStringSetting = "dbConnString")]
IEnumerable<object> models)
但在这里我不能指定 feedoptions
其中
feedOptions = new FeedOptions { MaxItemCount = count, EnableCrossPartitionQuery = true };
有an extension method for that,可以这样用:
using Microsoft.Azure.Cosmos.Linq;
...
var query = client.CreateDocumentQuery<User>(collectionUri, feedoptions)
.Where(u => !u.orderid.IsDefined());
通常我会
var query = client.CreateDocumentQuery<Customer>(collectionUri, feedOptions)
.Where(u => c.orderdate != null).AsDocumentQuery();
这是带有内置类型检查功能的 Azure Cosmos 数据库查询,
"Select * from c where not IS_DEFINED(c.middlename) order by c.firstname"
我想在 Azure 函数应用程序中使用上述查询作为 DocumentClient.CreateDocumentQuery() 的一部分,该怎么做?
// 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));
或
还有哪些其他方法可以在 Azure 函数应用程序中使用上述 'select' 查询以及 feedoptions?
在 Azure 函数应用程序中使用 sql 查询的方法之一是,
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get")] HttpRequest req,
[CosmosDB(databaseName: "%dbName%",
collectionName: "%collection%",
SqlQuery ="Select * from c",
ConnectionStringSetting = "dbConnString")]
IEnumerable<object> models)
但在这里我不能指定 feedoptions 其中
feedOptions = new FeedOptions { MaxItemCount = count, EnableCrossPartitionQuery = true };
有an extension method for that,可以这样用:
using Microsoft.Azure.Cosmos.Linq;
...
var query = client.CreateDocumentQuery<User>(collectionUri, feedoptions)
.Where(u => !u.orderid.IsDefined());