shiftcode/dynamo-easy

Using contains conditional with @CollectionProperty

vberistain opened this issue · 0 comments

Describe the bug
Can't use contains conditional with a list attribute.

To Reproduce

My model:

@Model()
class Item {
    @PartitionKey()
    id: string;

    @CollectionProperty()
    groupIds: string[];
}

My query (scan):

const items: Item[] = await itemStore
            .scan()
            .whereAttribute('groupIds')
            .contains(["ecb4b030-a4e6-11eb-8c07-f9fa6efb8c80", "8ff5ca30-a4e8-11eb-b3ad-cb2de6cf945b"])
            .exec();

I get the following error in response:

Type L of {\"L\":[{\"S\":\"ecb4b030-a4e6-11eb-8c07-f9fa6efb8c80\"},{\"S\":\"78c49850-a4e8-11eb-8be5-535d967d1ee5\"},{\"S\":\"8ff5ca30-a4e8-11eb-b3ad-cb2de6cf945b\"},{\"S\":\"7f68a590-a4e6-11eb-85d7-a327cfbc3c11\"}]} is not allowed for contains condition. Valid types are: N. S. B

I can't figure out what am I missing here.

Thanks in advance.