Update Rows
Update a Single Row
You can use the updateRow() SDK to update the row data of a single row in the table in Catalyst DataStore.
To update the required row, you need to construct a JSON object with the required values and pass it as an argument to the updateRow() SDK method.
The table reference used in the below code snippets can either be a table instance or a table meta.
Parameters Used
| Parameter Name | Data Type | Definition |
|---|---|---|
| ROWID | Int | A mandatory parameter. Will hold the value of the row that you need to update. |
// Construct a JSON Object with the updated row details
const updatedRowData = { Name: "Mathew Jones", Age: 31, ROWID: 1510000000109474 };
// Use Table Meta Object to update a single row using ROWID
const datastore = new Datastore();
const table = datastore.table("SampleTable");
const row = await table.updateRow(updatedRowData);
console.log(row);
Example of Expected Response
The promise returned here will be resolved to a JSON row object.
{
"CREATORID": "2136000000006003",
"MODIFIEDTIME": "2021-08-17 13:02:11:184",
"CREATEDTIME": "2021-08-16 16:29:10:499",
"Name": "Mathew Jones",
"Age": 31,
"ROWID": "2136000000011011"
}
Update Multiple Rows
You can use the updateRows() SDK method to update multiple rows stored in a table in the Catalyst DataStore.
To update multiple rows, you need to construct an array of JSON objects, and pass it as an argument to the updateRows() SDK method. You can refer to the required table using its ID or name.
The table reference used in the below code snippets can either be a table instance or a table meta.
Parameters Used
| Parameter Name | Data Type | Definition |
|---|---|---|
| ROWID | Int | A mandatory parameter. Will hold the value of the row that you need to update. |
// Data to be updated along with the ROWID
const updatedRowsData = [
{ Name: "Mathew Jones", Age: 31, ROWID: 1510000000113298 },
{ Name: "Rhonda Watson", Age: 28, ROWID: 1510000000109474 }
];
// Use Table Meta Object to update multiple rows using ROWIDs
const datastore = new Datastore();
const table = datastore.table("SampleTable");
const rows = await table.updateRows(updatedRowsData);
console.log(rows);
Example of Expected Response
[
{
"CREATORID": "2136000000006003",
"MODIFIEDTIME": "2021-08-24 13:22:14:718",
"CREATEDTIME": "2021-08-24 13:12:55:999",
"Name": "Mathew Jones",
"Age": 31,
"ROWID": "2136000000034043"
},
{
"CREATORID": "2136000000006003",
"MODIFIEDTIME": "2021-08-24 13:22:14:728",
"CREATEDTIME": "2021-08-24 13:12:56:001",
"Name": "Rhonda Watson",
"Age": 28,
"ROWID": "2136000000034045"
}
]
Last Updated 2026-07-02 14:51:41 +0530 IST
Yes
No
Send your feedback to us