DeleteItem

Deletes a single item in a table by primary key. You can perform a conditional delete operation that deletes the item if it exists, or if it has an expected attribute value.

Source:
See:

Methods

(inner) remove(key, request) → {Promise}

Source:
See:

Deletes a single item in a table by primary key. Returns the Attributes present in the DynamoDB response, which, by default, will contain the attributes returned by setting ReturnValues to ALL_OLD. This function uses DeleteItem operation internally.

Example
// Deletes an item of primary key `{id: 2}` in `SomeTable`
 await remove(42, { TableName: 'SomeTable' });
Parameters:
Name Type Description
key *

The primary key value of the item to delete.

request Object

Parameters as expected by DynamoDB DeleteItem operation. Must include, at least, a TableName attribute.

Returns:

A promise that resolves to the Attributes property of the DynamoDB response. Unless, ReturnValues has been explicitly set, this will match all attributes of the recently deleted element.

Type
Promise

(inner) removeFor(tableName, key, requestopt) → {Promise}

Source:
See:

Returns a function that deletes a single item in a table by primary key. Returns the Attributes present in the DynamoDB response, which, by default, will contain the attributes returned by setting ReturnValues to ALL_OLD. This function uses DeleteItem operation internally. You would typically use this function through forTable.

Examples
// Deletes an item of primary key `{id: 2}` in `SomeTable`
 await removeFor('SomeTable')(42, { TableName: 'SomeTable' });
// Exported from `forTable`
 const { remove } = forTable('SomeTable');
 await remove(42);
Parameters:
Name Type Attributes Description
tableName String

The name of the table to perform the operation on

key *

The primary key value of the item to delete.

request Object <optional>

Parameters as expected by DynamoDB DeleteItem operation (optional). Any Key or TableName attributes specified here will override primary key value in key or tableName arguments.

Returns:

A promise that resolves to the Attributes property of the DynamoDB response. Unless, ReturnValues has been explicitly set, this will match all attributes of the recently deleted element.

Type
Promise