Utilizing DocumentDB from Node.js
This section will cover how to build a Node.js application that is using the DocumentDB basics we discussed in the previous chapters. In this section, we will cover:
- Preparing our Node.js project
- Connecting to our DocumentDB account
- Querying documents using Node.js
- Creating a document using Node.js
Preparing our project
To use DocumentDB from our existing example project, we need to install some modules. Modules are maintained in the package.json
file inside our project. Installing additional modules will modify this JSON file with new entries. When deploying our new functionality to Azure, this file is used to determine what additional modules need to be installed on our Azure node.
We can install additional modules using the Node.js interactive window. This window can be activated from the View menu of Visuals Studio or by using the shortcut keys Ctrl + K, N. We need to install two additional modules called async
and documentdb
.
Our project is now ready to use...