如何为 GetCommand 编组复合键

问题描述 投票:0回答:0

我有一个 dynamo 表,分区键为“shop”,排序键为“item”。我想使用 GetItemCommand 使用此复合键查找特定项目。

  `const params = {
  TableName: process.env.DYNAMODB_TABLE_NAME,
  Key: marshall({shop: String(event.pathParameters.shop),
                  item: String(event.pathParameters.item) }),
   };
  const {Item} = await db.send(new GetItemCommand(params));
  console.log("item" + Item);`

但它返回 undefined

amazon-dynamodb marshalling
© www.soinside.com 2019 - 2024. All rights reserved.