# Wednesday, 07 November 2018

In the last article, I showed how to create a new Azure CosmosDB account. In this article, I will show how to add a database with containers to that account.

Navigate to the Azure portal and sign in; then open your Azure CosmosDB account. You may be directed to either the "Quick start" blade (Fig. 1) or the "Overview" blade (Fig. 2)

Co01-CosmosDBAccountQuickStart
Fig. 1

Co02-CosmosDBAccountOverview
Fig. 2

Open the "Data Explorer" blade, as shown in Fig. 3.

Co03-CosmosDBAccountDataExplorer
Fig. 3

For a newly-created account, no databases are listed.

To create a new database, click the [New Database] button (Fig. 4).

Co04-NewDatabaseButton
Fig. 4

The "New Database" blade displays, as shown in Fig. 5.

Co05-NewDatabaseBlade
Fig. 5

At the "Database id" field, enter a unique id for your database.

Click the [OK] button.

After a few seconds, a new database will display in the "Data Explorer" blade, as shown in Fig. 6.

Co06-Database
Fig. 6

In a CosmosDB database, documents are stored within collections, which help you to organize your data. To create  a new collection, right-click the database and select "New Collection" from the context menu, as shown in Fig. 7

Co07-NewCollectionMenu
Fig. 7

The "Add Collection" blade displays, as shown in Fig. 8

Co08-AddCollectionBlade
Fig. 8

At the "Collection Id" field, enter a name for your collection. Collection names must be unique within a database.

Select the appropriate Storage capacity. If you expect to store a small amount of data, select "Fixed"; for databases expected to grow beyond 10GB, select "Unlimited".

If you select unlimited, you can specify a path within each document to find the Partition Key. A Partition Key is used to determine which data to keep together when distributing data across multiple servers.

At the "Throughput" field, enter the number of 1K documents per second you need to process. You will pay more for higher throughput, so consider whether you need a higher throughput before increasing this value.

Click the [OK] button to create the collection.

The new collection will display beneath the database as shown in Fig. 9. You may need to expand the tree in order to see the collection.

Co09-DBandCollection
Fig. 9

You can write to and read from this collection programmatically or you can upload document within the portal by clicking the [Upload] button, as shown in Fig. 10.

Co10-UploadButton
Fig. 10

Data in a CosmosDB account is stored in databases and collections. This article showed how to create these.

Wednesday, 07 November 2018 06:36:00 (GMT Standard Time, UTC+00:00)
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

[Captcha]Enter the code shown (prevents robots):

Live Comment Preview