All Products
Search
Document Center

Tablestore:Delete a single row of data

Last Updated:Mar 12, 2026

Delete a single row from a Tablestore table by calling `deleteRow` in the Node.js SDK. Specify the primary key of the row and a deletion condition.

Prerequisites

Initialize a Tablestore client

Method

deleteRow: function deleteRow(params, callback)

Parameters

Name

Type

Description

tableName (Required)

string

The name of the data table.

primaryKey (Required)

Array

The primary key information. This includes the primary key column names and values.

  • The primary key columns can be of the STRING, INTEGER, or BINARY data type.

  • The number and types of primary keys must be the same as those of the data table.

condition (Required)

TableStore.Condition

The condition to delete the row. For more information, see Conditional update.

transactionId (Optional)

string

The unique ID of the local transaction. For more information, see Local transaction.

Examples

The following code deletes the row with the primary key value 'row1' from the test_table table.

var params = {
    tableName: 'test_table',
    // The primary key information.
    primaryKey: [{ 'id': 'row1' }],
    // Set a condition for the deletion. TableStore.RowExistenceExpectation.IGNORE skips the row existence check.
    condition: new TableStore.Condition(TableStore.RowExistenceExpectation.IGNORE, null)
};

client.deleteRow(params, function (err, data) {
    if (err) {
        console.log('Delete row failed with error: ', err);
        return;
    }
    console.log('RequestId: ', data.RequestId);
    console.log('Read CU Cost: ', data.consumed.capacityUnit.read);
    console.log('Write CU Cost: ', data.consumed.capacityUnit.write);
});

References

Batch update data