如何在dynamo DB上查询嵌套属性

时间:2017-09-20 01:17:21

标签: amazon-dynamodb aws-sdk dynamo-local

我有以下方式的数据结构。我想要检索所有具有subjectName PHYSICS PAPER-I和marksGained 40的记录。

是否可以查询此类记录?我们可以使用其他任何库来实现这个目标吗?

{
  "CID": "A1",
  "COL_ID": "HARISHFYSX",
  "district": "ADILABAD",
  "grandresult": "C",
  "grandtotal": "232",
  "stdntname": "JAMES",
  "subjects": [
    {
      "marksGained": "38",
      "outcome": "P",
      "passType": "*",
      "subjectName": "ENGLISH PAPER -I"
    },
    {
      "marksGained": "56",
      "outcome": "P",
      "passType": "*",
      "subjectName": "TELUGU PAPER-I"
    },
    {
      "marksGained": "42",
      "outcome": "P",
      "passType": "*",
      "subjectName": "BOTANY PAPER-I"
    },
    {
      "marksGained": "22",
      "outcome": "P",
      "passType": "*",
      "subjectName": "ZOOLOGY PAPER-I"
    },
    {
      "marksGained": "40",
      "outcome": "P",
      "passType": "*",
      "subjectName": "PHYSICS PAPER-I"
    },
    {
      "marksGained": "34",
      "outcome": "P",
      "passType": null,
      "subjectName": "CHEMISTRY PAPER-I"
    }
  ],
  "ticket": "1534343434",
  "UID": "A1_1534343434"
}

1 个答案:

答案 0 :(得分:2)

您无法在嵌套对象上进行查询,它将是一次扫描。以下论坛详细讨论,

https://forums.aws.amazon.com/thread.jspa?threadID=164470

希望它有所帮助。