I have a legacy table in DynamoDB, and this table contains a non-key field term
which is usually a Number
, but in some cases it is a String
containing a number
I want to query all items having this field a String
value, and it seems to be a pretty complex task
I tried NOT Contains (term, {S: "a"})
and it returns all items with Numbers and Strings
The only solution which works is to use
begins_with(term, {S: "0"} OR
begins_with(term, {S: "1"} OR
...
begins_with(term, {S: "9"}
I suppose that this is not the best solution
Maybe someone knows cleaner solution?
You should use the filter function attribute_type
:
attribute_type(term, "S"}