简体   繁体   English

DynamoDB 在使用 TransactWrtieItems 时返回修改后的文档(旧的或新的)

[英]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.

相关问题 更新 DynamoDB 的 GSI,旧数据不会在新 GSI 中更新 - Update GSI of DynamoDB, old data not update in new GSI 在文档上使用 Contains 的 DynamoDB filterexpression - DynamoDB filterexpression using Contains on a document boto3 和 lambda:使用 DynamoDB 资源和 localstack 时参数 KeyConditionExpression 的类型无效 - boto3 and lambda: Invalid type for parameter KeyConditionExpression when using DynamoDB resource and localstack 将 passport.js 与 DynamoDB 结合使用 - Using passport.js with DynamoDB 使用 Lambda 更新 DynamoDB 表 - Updating DynamoDB table using a Lambda 从第 3 方 API 收集数据时如何更新 Firestore 文档而不是创建新文档 - How to update Firestore document when data changes when collected from 3rd Party API instead of creating new document 使用 Apache Camel 和 Java DynamoDB 注释将项目写入 DynamoDB - Write item to DynamoDB using Apache Camel with Java Annotations for DynamoDB DynamoDB 分页 - 知道什么时候没有更多结果 - DynamoDB pagination - knowing when there is no more results 如何使用 Lambda NodeJS 比较 DynamoDB 中的字符串? - How to compare strings in DynamoDB using Lambda NodeJS? 使用 AWS SAM 和 DynamoDB 限制 Lambda 权限 - Limiting Lambda Permissions using AWS SAM and DynamoDB
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM