Skip to content

Commit

Permalink
Update CosmosDB package used in tests (Azure#10127)
Browse files Browse the repository at this point in the history
  • Loading branch information
jviau authored May 8, 2024
1 parent 03ab073 commit 169a269
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
using Microsoft.Azure.Documents.Linq;
using Microsoft.Azure.Cosmos;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Extensions.Configuration;
Expand Down Expand Up @@ -37,17 +35,11 @@ public async Task<IActionResult> Run(
builder.TryGetValue("AccountEndpoint", out object dbUri);
builder.TryGetValue("AccountKey", out object dbKey);

var client = new DocumentClient(new Uri(dbUri.ToString()), dbKey.ToString());
Uri collUri = UriFactory.CreateDocumentCollectionUri("ItemDb", "ItemCollection");
var client = new CosmosClient(dbUri.ToString(), dbKey.ToString());

var options = new FeedOptions
{
EnableCrossPartitionQuery = true
};

IDocumentQuery<Document> documentQuery = client.CreateDocumentQuery<Document>(collUri, "SELECT * FROM c WHERE STARTSWITH(c.id, @PartitionLeasePrefix)", options).AsDocumentQuery<Document>();

await documentQuery.ExecuteNextAsync();
Container container = client.GetDatabase("ItemDb").GetContainer("ItemCollection");
FeedIterator iterator = container.GetItemQueryStreamIterator("SELECT * FROM c");
await iterator.ReadNextAsync();
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.3.0" />
<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.39.1" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
Expand Down

0 comments on commit 169a269

Please sign in to comment.