sensedeep / dynamodb-onetable

DynamoDB access and management for one table designs with NodeJS
https://doc.onetable.io/
MIT License
690 stars 109 forks source link

fix: log error on missing required fields when finding with fields selection #533

Closed onhate closed 4 months ago

onhate commented 4 months ago

fix #532

mobsense commented 4 months ago

Thank you!

revmischa commented 4 months ago

What should I do if I add a new required field but still have old objects in my DB which lack a value for that field? Now this is giving me errors for those objects.

mobsense commented 4 months ago

The code will emit a log message but will otherwise work. The alternative is worse where you can have items that don't match the schema and it will return the items silently. This patch addresses that issue.

You can set the {noerror: true} param to suppress the message in 2.7.5.

The real solution is to do a migration to update old items that now don't match the schema.