在Node.js中使用DynamoDB查询嵌套值

时间:2019-08-05 17:42:46

标签: node.js amazon-dynamodb dynamodb-queries

我有一个DynamoDB表,一个Item具有以下结构:

{
  pickup: "Florida",
  tonnage: {
    "3ton": {
      type: {
        nonrefrigerated: [...],
        refrigerated: [...]
      },
      "5ton": {
        type: {
            nonrefrigerated: [...],
            refrigerated: [...]
        }
      }
    }
  }
}

我可以通过这样的键来获取商品:

function getData(callback) {
  let params = {
    TableName: "Locations",
    Key: {
      pickup: "Florida"
    }
  };

  db.get(params, function(err, data) {
    callback(err, data);
  });
}

但是如何查询嵌套数据? AWS文档尚不清楚。例如,如何查询:

Select from Locations WHERE pickup='Florida' AND tonnage='5ton' AND Type='nonrefrigerated'

0 个答案:

没有答案