简体   繁体   中英

Filter expression to check empty value is present in array or not in DynamoDB

I have data stored as [ { "S": "" } ] in DynamoDB. I want to check whether the record contain empty value or not so I tried

FilterExpression : `contains (columnName, :data)`
   ExpressionAttributeValues:{
   ":data": ""
}

But i am getting no result from query. What is wrong with this?

I've created 2 items in the DDB table. 1 with empty value, 1 with non-empty value as follows:

在此处输入图像描述

Then I ran this query:

{
  "TableName": "xxx",
  "FilterExpression": "#DDB_data5vizmh5osmv = :data5vizmh5osmv",
  "ExpressionAttributeNames": {
    "#DDB_data5vizmh5osmv": "data"
  },
  "ExpressionAttributeValues": {
    ":data5vizmh5osmv": ""
  }
}

And here are the results I got. I filtered 1 item with empty value.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM