Skip to content
Advertisement

Dynamodb scan items by presence of a Document Type Map.AttributeName

I have this Item structure:

{
    "Items": [
        {
            "serviceName": {
                "S": "B"
            },
            "sharedData": {
                "M": {
                    "five": {
                        "S": "5"
                    }
                }
            }
        }
}

I want to scan data by the presence of key five “five” within sharedData map. Something like sharedData.five exists or sharedData.five == *.

Is this possible?

Advertisement

Answer

aws dynamodb scan --table-name YOURTABLE --filter-expression 'attribute_exists(sharedData.five)'

Here is the CLI answer. You will need to turn it into Java, which is simple enough.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement