Skip to main content

BatchDeleteRequest

Builds a request to delete an entity item, to be used within BatchWriteCommands:

import { BatchDeleteRequest } from 'dynamodb-toolbox/entity/actions/batchDelete'

const request = PokemonEntity.build(BatchDeleteRequest)

const params = request.params()

Request

.key(...)

(required)

The key of the item to delete (i.e. attributes that are tagged as part of the primary key):

const request = PokemonEntity.build(BatchDeleteRequest).key(
{ pokemonId: 'pikachu1' }
)

You can use the KeyInputItem generic type to explicitly type an object as a BatchDeleteRequest key object:

import type { KeyInputItem } from 'dynamodb-toolbox/entity'

const key: KeyInputItem<typeof PokemonEntity> = {
pokemonId: 'pikachu1'
}

const request = PokemonEntity.build(BatchDeleteRequest).key(
key
)
info

Contrary to DeleteItemCommands, batch deletes cannot be conditioned, nor return the values of the deleted items.