[AZURE.SELECTOR]
Sample solutions that perform CRUD operations and other common operations on DocumentDB resources are included in the azure-documentdb-nodejs GitHub repository. This article provides:
- Links to the tasks in each of the Node.js example project files.
- Links to the related API reference content.
Prerequisites
-
You need an Azure account to use these Node.js examples:
- You can open an Azure account for free: You get credits you can use to try out paid Azure services, and even after they're used up you can keep the account and use free Azure services, such as Websites. Your credit card will never be charged, unless you explicitly change your settings and ask to be charged.
- You can activate Visual Studio subscriber benefits: Your Visual Studio subscription gives you credits every month that you can use for paid Azure services.
-
You also need the Node.js SDK.
[AZURE.NOTE] Each sample is self-contained, it sets itself up and cleans up after itself. As such, the samples issue multiple calls to DocumentClient.createCollection. Each time this is done your subscription will be billed for 1 hour of usage per the performance tier of the collection being created.
The app.js file of the DatabaseManagement project shows how to perform the following tasks.
The app.js file of the CollectionManagement project shows how to perform the following tasks.
The app.js file of the DocumentManagement project shows how to perform the following tasks.
The app.js file of the IndexManagement project shows how to perform the following tasks.
For more information about indexing, see DocumentDB indexing policies.
The app.js file of the ServerSideScripts project shows how to perform the following tasks.
Task | API reference |
---|---|
Create a stored procedure | DocumentClient.createStoredProcedure |
Execute a stored procedure | DocumentClient.executeStoredProcedure |
For more information about server-side programming, see DocumentDB server-side programming: Stored procedures, database triggers, and UDFs.
The app.js file of the Partitioning project shows how to perform the following tasks.
Task | API reference |
---|---|
Use a HashPartitionResolver | HashPartitionResolver |
For more information about partitioning data in DocumentDB, see Partition and scale data in DocumentDB.