Developing a Node.js console app using DocumentDB

Last updated: 5/30/2018
Edit on GitHub

This sample shows you how to use the Microsoft Azure DocumentDB service to store and access data from a Node.js console application.

Running this sample

  1. Before you can run this sample, you must have the following perquisites:

  2. Clone this repository, or download the zip file.

  3. Retrieve the URI and PRIMARY KEY (or SECONDARY KEY) values from the Keys blade of your DocumentDB account in the Azure Preview portal. For more information on obtaining endpoint & keys for your DocumentDB account refer to How to manage a DocumentDB account.

    If you don't have an account, see Create a DocumentDB database account to set one up.

  4. In the config.js file, located in the src folder, find config.endpoint and config.authKey and replace the placeholder values with the values obtained for your account.

    config.endpoint = "~your DocumentDB endpoint here~";

    config.authKey = "~your auth key here~";

  5. Run npm install in a terminal to install required npm modules

  6. Run node app.js in a terminal to start your start your node application.

About the code

The code included in this sample is intended to get you quickly started with a Node.js console application that connects to Azure DocumentDB.

More information