3

I have data structure in the following way. I want to retrieve all records which are having subjectName PHYSICS PAPER-I and marksGained 40.

Is it possible to query to such records? are there any other libraries we can use on to achieve this?

{
  "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 Answer 1

3

Updated:

AWS Started supporting queries for nested object with expressions.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Attributes.html

Outdated: Keeping it for reference.

You cannot query on a nested object, it will be a scan. Following forum discussed in detail,

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

Hope it helps.

Sign up to request clarification or add additional context in comments.

1 Comment

This answers the letter of the question - no it's not possible using the 'query' - but not the spirit of the question - how do to find items whose nested keys match a particular value. Also the link is dead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.