Introduction

Completed

In this module, you'll learn how to create and manage a Cosmos DB Core (SQL) database and container with the Azure JavaScript SDK for Cosmos DB. Azure Cosmos DB Core (SQL) provides for data management of JSON documents using Structured Query Language (SQL) syntax.

Example scenario

Imagine you are a software developer for the fictitious outdoor equipment company Contoso. You've been asked to create a new Cosmos DB resource, and upload the products JSON dataset. Once the dataset is uploaded in a container, you need to be able to find products and their inventory levels, and update products.

You'll learn how to work with a Cosmos DB resource, database, and container from Visual Studio Code and the JavaScript SDK to insert, find, and update products.

What will you be doing?

You'll use Visual Studio Code and the Azure Databases extension to create your account, database and container then add some dummy data to learn how to use the Databases extension. Then you'll create the Node.js application and learn how to programmatically insert, find, and update your data.

These steps include:

  • Create Cosmos DB Core (SQL) account.
  • Manually add, update, and delete documents from Azure explorer in Visual Studio Code.
  • Use JavaScript to automate add, update, and query operations with the @azure/cosmos npm package.

What is the main goal?

The main goal is to teach you how to interact with your Cosmos DB Core (SQL) container programmatically with the JavaScript SDK from Visual Studio Code.

If you start the module and feel you aren't ready for these tasks, complete the Cosmos DB Core (SQL) quickstart then return to this module.

Prerequisites

Your local development machine should have the following installed before you continue:

  • Node.js LTS version
  • Visual Studio Code and the following extensions:
    • Azure Databases - this extension will install any other Azure extensions it needs