[英]DynamoDB return the modified document (Old or new) when using TransactWrtieItems
Is there a way of making transactWriteItem
return the document it updated?有没有办法让transactWriteItem
返回它更新的文档?
const transactionParams = {
ReturnConsumedCapacity: "INDEXES",
TransactItems: [
{
Delete: {
TableName: reactionTableName,
Key: {
"SOME_PK_",
"SOME_SK_",
},
ReturnValues: 'ALL_OLD',
},
},
{
Update: {
TableName: reviewTableName,
Key: { PK: "SOME_PK", SK: "SOME_SK" },
ReturnValues: 'ALL_OLD',
},
},
],
};
try {
const result = await docClient.transactWrite(transactionParams).promise();
} catch (error) {
context.done(error, null);
}
For example in the above code get the documents that were touched (before or after update)?例如在上面的代码中获取被触摸的文档(更新之前或之后)?
No, TransactWriteItems
API does not provide the ability to return values of a modified item, however, you could obtain those values using DynamoDB Streams, otherwise you would need to default to the singleton APIs UpdateItem/DeleteItem which are not ACID compliant together.不, TransactWriteItems
API 不提供返回已修改项的值的能力,但是,您可以使用 DynamoDB Streams 获取这些值,否则您需要默认使用 singleton APIs UpdateItem/DeleteItem,它们不符合 ACID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.