Skip to content

Azure/azure-cosmos-dotnet-v3

Folders and files

NameName
Last commit message
Last commit date
Jan 22, 2024
Jan 22, 2025
Nov 19, 2024
Dec 16, 2024
Feb 21, 2025
Jan 8, 2025
Feb 10, 2025
Nov 9, 2024
Sep 18, 2020
Mar 3, 2022
Nov 5, 2018
Nov 29, 2022
Sep 10, 2019
Sep 16, 2024
Nov 10, 2022
Aug 5, 2019
Feb 20, 2025
Dec 21, 2020
Nov 19, 2024
Nov 5, 2018
Nov 18, 2024
Jul 14, 2020
Nov 21, 2023
May 19, 2022
Aug 26, 2020
Sep 23, 2020
Oct 31, 2023
Jan 19, 2022
Aug 12, 2019
Jun 28, 2024
Oct 9, 2024
Oct 9, 2024
Nov 28, 2024
Aug 29, 2022
Oct 6, 2023
Feb 8, 2025
Oct 6, 2024
Feb 11, 2025
Feb 20, 2025
Jan 15, 2019
Sep 10, 2019

Repository files navigation

NuGet NuGet Prerelease

Microsoft Azure Cosmos DB .NET SDK Version 3

This client library enables client applications to connect to Azure Cosmos DB for NoSQL. Azure Cosmos DB is a globally distributed, multi-model database service. For more information, refer to https://azure.microsoft.com/services/cosmos-db/.

CosmosClient client = new CosmosClient("https://mycosmosaccount.documents.azure.com:443/", "mysupersecretkey");
Database database = await client.CreateDatabaseIfNotExistsAsync("MyDatabaseName");
Container container = await database.CreateContainerIfNotExistsAsync(
    "MyContainerName",
    "/partitionKeyPath",
    400);

// Create an item
dynamic testItem = new { id = "MyTestItemId", partitionKeyPath = "MyTestPkValue", details = "it's working", status = "done" };
ItemResponse<dynamic> createResponse = await container.CreateItemAsync(testItem);

// Query for an item
using (FeedIterator<dynamic> feedIterator = container.GetItemQueryIterator<dynamic>(
    "select * from T where T.status = 'done'"))
{
    while (feedIterator.HasMoreResults)
    {
        FeedResponse<dynamic> response = await feedIterator.ReadNextAsync();
        foreach (var item in response)
        {
            Console.WriteLine(item);
        }
    }
}

Install via Nuget.org

Install-Package Microsoft.Azure.Cosmos

For available versions, see SDK versioning.

Useful links

Microsoft Open Source Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct.

Resources:

Contributing

For details on contributing to this repository, see the contributing guide.

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.