tywalch / electrodb

A DynamoDB library to ease the use of modeling complex hierarchical relationships and implementing a Single Table Design while keeping your query code readable.
MIT License
1.03k stars 66 forks source link

Redundant FilterExpression in query of hierarchical sort key #419

Open dmeehan1968 opened 3 months ago

dmeehan1968 commented 3 months ago

Describe the bug

I was experimenting with creating a hierarchical sort key and then doing a query, and found that EDB adds what appears to be a redundant FilterExpression to the generated query command.

Unless I'm overlooking something, the filter is redundant as the constructed sort key can only match exactly on the given kingdom. Playground

If you move 'kingdom' into the PK the filter expression goes away. Playground

If you add another attribute into the schema and use that in the PK, the problem remains. Playground

ElectroDB Version

2.14.3 (and playground)

ElectroDB Playground Link

ElectroDB Playground (same as first link above)

Expected behavior

No redundancy in generated commands