How can I use LINQ in CosmosDB SDK v3.0 async query?

后端 未结 2 1224
野的像风
野的像风 2021-02-20 08:26

I\'ve been following the official documentation here: https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-get-started#Query

But I can\'t figure out how to correctly

2条回答
  •  别那么骄傲
    2021-02-20 08:53

    You would use ToFeedIterator() and FeedIterator.ReadNextAsync().

    var db = Client.GetDatabase(databaseId);
    var container = db.GetContainer(containerId);
    
    var q = container.GetItemLinqQueryable();
    var iterator = q.Where(p => p.Name == "Name").ToFeedIterator();
    var results = await iterator.ReadNextAsync();
    

提交回复
热议问题