This documentation is not maintained. Please refer to doc.castsoftware.com/technologies to find the latest updates.

CAST supports Azure Cosmos DB via its com.castsoftware.nodejs extension. Details about how this support is provided for Node.js source code is discussed below.

Objects

IconDescription

Node.js Azure CosmosDB Database

Node.js Azure CosmosDB Collection

Node.js Azure CosmosDB Unknown Database

Node.js CosmosDB Unknown Collection

Detailed support

The @azure/cosmos package is supported. Whenever a container client use one of the method listed in the following table, a link is created to the corresponding collection.

LinkTypeMethods from ContainerMethods from ItemMethods from Items
useDeletedeletedeletebatch, bulk
useSelect-read, querybatch, bulk, query, readAll
useUpdate-replacebatch, bulk, upsert
useInsert--batch, bulk, create

If the evaluation of the container name fails (either due to missing information in the source code or to limitations in the evaluation) a link is created to an Unknown collection.

What results can you expect?

When analyzing the following source code:

const CosmosClient = require("@azure/cosmos");
const client = new CosmosClient({ endpoint: endpoint, auth: { masterKey } });
const databaseId = 'My database'
const collectionId = 'My collection'

// CREATE DATABASE
const dbResponse = client.databases.createIfNotExists({
  id: databaseId
});
database = dbResponse.database;

// CREATE COLLECTION
const coResponse = database.containers.createIfNotExists({
  id: collectionId
});
container = coResponse.container;

// QUERY
var param = {
    query: "SELECT * FROM root r WHERE r.completed=@completed",
    parameters: [
        {
            name: '@completed',
            value: false
        }
    ]
};

const { result: results } = container.items
    .query(param)
    .toArray();


client.database(databaseId).delete()

you will get the following result:

Known Limitations

  • The link type for bulk and batch methods is not evaluated. All possible link types are created.