All Products
Search
Document Center

Tablestore:Delete a single row of data

Last Updated:Jun 22, 2026

Call the deleteRow method in the Node.js SDK to delete a single row from a Tablestore data table by specifying the primary key 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 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

This example 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