[英]AWS DynamoDB delete Item using lambda nodejs
I am trying to delete some entries from DynamoDB table, but I keep getting the error: ValidationException: The provided key element does not match the schema我正在尝试从 DynamoDB 表中删除一些条目,但我不断收到错误消息:ValidationException: The provided key element does not match the schema
Screen shot of the entry I want to delete, partition key is identifier
:我要删除的条目的屏幕截图,分区键是
identifier
:
I have tried the following code:我尝试了以下代码:
I am using dynamodb = AWS.DynamoDB.DocumentClient我正在使用 dynamodb = AWS.DynamoDB.DocumentClient
what am I doing wrong???我究竟做错了什么???
If you want to delete an item, you have to specify the entire primary key.如果要删除项目,则必须指定整个主键。 In the case of a table with a composite key, that means both partition and sort keys are required.
对于具有复合键的表,这意味着需要分区键和排序键。
From documentation for DeleteItem
- Key
attribute :从
DeleteItem
的文档 - Key
属性:
For the primary key, you must provide all of the attributes.
对于主键,您必须提供所有属性。 For example, with a simple primary key, you only need to provide a value for the partition key.
例如,对于简单的主键,您只需为分区键提供一个值。 For a composite primary key, you must provide values for both the partition key and the sort key.
对于复合主键,您必须为分区键和排序键提供值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.