Update Items in a NoSQL 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.
There are two ways to update the data. Data can be updated without any conditions by using the ZCNoSQLTable instance or it can be updated with the help of ZCNoSQLUpdateHelper instance which can be used to construct the various parts of the request.
You can update the data with the ZCNoSQLTable instance as shown below.
copy//public ZCNoSQLResponseBean update(ZCNoSQLItem item, ZCNoSQLUpdateAttributeOperation updateAttributeOperation) throws Exception; table.update(<ZCNoSQLItem>, <ZCNoSQLUpdateAttributeOperation>);
To update with ZCNoSQLUpdateHelper
ZCNoSQLUpdateHelper
copy//public ZCNoSQLInsertHelper getInsertHelper(ZCNoSQLItem item) throws Exception; //public ZCNoSQLResponseBean insert() throws Exception; table.getUpdateHelper(<ZCNoSQLItem>, <ZCNoSQLUpdateAttributeOperation>).update();
ZCNoSQLUpdateAttributeOperation
This class is used update the item by either adding/updating existing attribute or deleting existing attribute. An instance of the above can be obtained using the below methods.
For inserting or updating attributes
copy//ZCNoSQLUpdateAttributeOperation(ZCNoSQLAttribute attribute, ZCNoSQLValue updateValue); //ZCNoSQLUpdateAttributeOperation(ZCNoSQLAttribute attribute, NoSQLUpdateAttributeFunction updateFunction); //public static ZCNoSQLUpdateAttributeOperation getPutAttributeInstance(ZCNoSQLAttribute attribute, ZCNoSQLValue updateValue); // public static ZCNoSQLUpdateAttributeOperation getPutAttributeInstance(ZCNoSQLAttribute attribute, NoSQLUpdateAttributeFunction updateFunction); new ZCNoSQLUpdateAttributeOperation(<ZCNoSQLAttribute>, <ZCNoSQLValue>); new ZCNoSQLUpdateAttributeOperation(<ZCNoSQLAttribute>, <NoSQLUpdateAttributeFunction>); ZCNoSQLUpdateAttributeOperation.getPutAttributeInstance(<ZCNoSQLAttribute>, <ZCNoSQLValue>); ZCNoSQLUpdateAttributeOperation.getPutAttributeInstance(<ZCNoSQLAttribute>, <NoSQLUpdateAttributeFunction>)
For Deleting attributes
copy//ZCNoSQLUpdateAttributeOperation(ZCNoSQLAttribute attribute); //public static ZCNoSQLUpdateAttributeOperation getDeleteAttributeInstance(ZCNoSQLAttribute attribute); new ZCNoSQLUpdateAttributeOperation(<ZCNoSQLAttribute>); ZCNoSQLUpdateAttributeOperation.getDeleteAttributeInstance(<ZCNoSQLAttribute>);
Update also have certain prebuilt functions that can be used to update the values. These functions can be grouped under the type NoSQLUpdateAttributeFunction and can be used while obtaining the ZCNoSQLUpdateAttributeOperation instance.
NoSQLUpdateAttributeFunction
There are 4 prebuild functions.
ZCNoSQLIfNotExistFunction
This function is used update the attribute with the value of another existing attribute. If the attribute does not exist, then the given value is updated.
copy//public ZCNoSQLIfNotExistFunction(ZCNoSQLAttribute attribute, ZCNoSQLValue value) //public static ZCNoSQLIfNotExistFunction getInstance(ZCNoSQLAttribute attribute, ZCNoSQLValue value); new ZCNoSQLIfNotExistFunction(<ZCNoSQLAttribute>, <ZCNoSQLValue>) ZCNoSQLIfNotExistFunction.getInstance(<ZCNoSQLAttribute>, <ZCNoSQLValue>)
ZCNoSQLAppendListFunction
This function is append elements to existing or new list attribute.
copy//public ZCNoSQLAppendListFunction(ZCNoSQLValue...values); //public static ZCNoSQLAppendListFunction getInstance(ZCNoSQLValue...values); new ZCNoSQLAppendListFunction(<List of ZCNoSQLValue>) ZCNoSQLAppendListFunction.getInstance(<List of ZCNoSQLValue>)
ZCNoSQLAdditionFunction
This function is used to add elements to a set or add numeric value to existing attribute. The type of operation depends on the targetted attribute type.
copy//public ZCNoSQLAdditionFunction(ZCNoSQLAttribute attribute, ZCNoSQLValue value); //public static ZCNoSQLAdditionFunction getInstance(ZCNoSQLAttribute attribute, ZCNoSQLValue value); new ZCNoSQLAdditionFunction(<ZCNoSQLAttribute>, <ZCNoSQLValue>) ZCNoSQLAdditionFunction.getInstance(<ZCNoSQLAttribute>, <ZCNoSQLValue>)
ZCNoSQLReductionFunction
This function is used to remove elements from a set or subtract numeric value to existing attribute. The type of operation depends on the targetted attribute type.
copy//public ZCNoSQLReductionFunction(ZCNoSQLAttribute attribute, ZCNoSQLValue value) throws Exception; //public static ZCNoSQLReductionFunction getInstance(ZCNoSQLAttribute attribute, ZCNoSQLValue value) throws Exception; new ZCNoSQLReductionFunction(<ZCNoSQLAttribute>, <ZCNoSQLValue>) ZCNoSQLReductionFunction.getInstance(<ZCNoSQLAttribute>, <ZCNoSQLValue>)
Other methods available in ZCNoSQLUpdateHelper
ZCNoSQLCondition
The Same conditions described above can be reused for update too.
NOSQL_RETURN_VALUE
The Same return value described above can be reused for update too.
Update with Condition and Return Value
copytable.getUpdateHelper(<ZCNoSQLItem>,<ZCNoSQLUpdateAttributeOperation>).withCondition(<ZCNoSQLCondition>).withReturnValue(<NOSQL_RETURN_VALUE>).update();
Last Updated 2025-06-20 16:21:48 +0530 +0530
Yes
No
Send your feedback to us