Update Items in Table

Catalyst enables you to update items in a specific NoSQL table after you construct them. An item can be updated by identifying it using its primary keys. For instance, you can use just the partition key or a combination of the partition key and sort key to identify the item.

You can then define the update operation type with the appropriate HTTP request method and provide the attributes and values to be updated in the item.

Note: Catalyst enables you to update a maximum of 25 items in bulk in a NoSQL table with a single SDK operation.

The example below illustrates this by identifying an item with the partition key fruitName and value “Apple”. The values for the attributes of this item to be updated, color and taste are provided, along with the path to these attributes.

The no-sql library from the zcatalyst-sdk-node package is required to define and construct the NoSQL item.

    
copy
const { NoSQLItem, NoSQLEnum } = require('zcatalyst-sdk-node/lib/no-sql'); const { NoSQLOperator } = NoSQLEnum; // Update a NoSQL Item identified with the partition key "apple" with its properties attribute updated const updatedItems = await table.updateItems({ // Define the partition key value of the item to be updated keys: [new NoSQLItem().addString('fruit', 'apple')], // Define the attributes to be updated update_attributes: [ { // Specify the type of the update operation operation_type: NoSQLUpdateOperationType.PUT, // Provide the values for the attribute to be updated update_value: NoSQLMarshall.makeMap({ color: 'Green', taste: 'Sour' }), // Specify the path to the attributes attribute_path: ['fruitProperties'] } ] });

Last Updated 2025-06-20 16:21:48 +0530 +0530

ON THIS PAGE