Examples for Azure Cosmos DB for NoSQL SDK for .NET
APPLIES TO: NoSQL
The cosmos-db-nosql-dotnet-samples GitHub repository includes multiple sample projects. These projects illustrate how to perform common operations on Azure Cosmos DB for NoSQL resources.
Prerequisites
- An Azure account with an active subscription. Create a trial subscription.
- Azure Cosmos DB for NoSQL account. Create a API for NoSQL account.
- .NET 6.0 or later
- Azure Command-Line Interface (CLI) or Azure PowerShell
Samples
The sample projects are all self-contained and are designed to be ran individually without any dependencies between projects.
Client
Databases
Task | API reference |
---|---|
Create a database | CosmosClient.CreateDatabaseIfNotExistsAsync |
Containers
Task | API reference |
---|---|
Create a container | Database.CreateContainerIfNotExistsAsync |
Items
Task | API reference |
---|---|
Create an item | Container.CreateItemAsync<> |
Point read an item | Container.ReadItemAsync<> |
Query multiple items | Container.GetItemQueryIterator<> |
Next steps
Dive deeper into the SDK to import more data, perform complex queries, and manage your Azure Cosmos DB for NoSQL resources.