clarkie / dynogels

DynamoDB data mapper for node.js. Originally forked from https://github.com/ryanfitz/vogels

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Empty List and Maps

mataide opened this issue · comments

As by Docs:

Attribute Values
An attribute value cannot be an empty String or empty Set (String Set, Number Set, or Binary Set). However, empty Lists and Maps are allowed.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html

Doing some tests, dynamodb allow empty List and Maps, but I cant create using Dynogels.

When you try to save a model using create method, it saves but without the empty values.
When you try to save a model using update method, it saves but with the empty values.

You are correct, dynomodb supports empty Lists and Maps.

But in the create method in dynogels they omit empty String Set, Number Set, or Binary Set but they also omits empty Lists and Maps(don't know if it's a big change to allow empty Lists and Maps)

What i did was to skip the create method and instead do an update call which have Conditional Expression that the key cannot exist.
An ugly workaround but it works.

PS: You dont get the auto generated createdAt if you use a update call instead

No update on it ?