Creating a new Cosmos DB collection

Perform the following steps:

  1. Once the account is created, you need to create a new database and a collection. We can create both of them in a single step right from the portal.
  2. Navigate to the Overview tab and click on the Add Collection button to create a new collection:

  1. You will now be navigated to the Data Explorer tab automatically, where you will be prompted to provide the following details:

Field Name

Value

Comment

Database id

cookbookdatabase

This is a container of multiple Cosmos DB collections.

Collection id

cookbookdatacollection

This is the name of the collection where you will be storing the data.

Storage capacity

Fixed (10 GB)

Depending on your production workloads, you might have to go with Unlimited, as you may get partitions otherwise.

Throughput (400 - 10,000 RU/s)

400

This is the capacity of your Cosmos DB Collection. The performance of the reads and writes on the collection depends on the throughput that you configure when provisioning the collection.

  1. Next, click on the OK button to create the collection. If everything went well, you will see something like the following in the Data Explorer tab of the Cosmos DB account:

We have successfully created a Cosmos DB account and a collection. Let's now learn how to integrate the collection with a new Azure Function and see how to trigger it whenever there is a change in the Cosmos DB collection.