Open WolfWalter opened 1 month ago
A couple of comments:
Regarding issue 1.
Regarding issue 2
ISO dates are encoded as strings, when you do a "set", you are directly setting the property value. So use the following instead:
set: {updatedAt: new Date().toISOString()}
Hi @mobsense, thanks for the feedback.
To use partial
in issue 1 is not what I expected, because it works with undefined and I gave the full address
. I guess I just hoped that null would be handled like undefined in this case, because onetable knows that it cannot be null and by using false as the the default for nulls
.
For issue 2 that's what we implemented after running into it. I didn't realize that set
does come without any of the onetable magic.
In OneTable, undefined and null mean 2 very different things. Null is used to indicate a property that must be deleted. Undefined is exactly the same as completely omitting the property.
Yes, you could argue that "set" should apply the onetable data mapping routines. If you feel strongly about this, I'll change this to an enhancement issue.
Describe the bug
We use onetable a lot and had some issues with some more advanced update use-cases. We ran into two issues:
set
it throws when isoDates is set to trueTo Reproduce
Demo repo with debug.ts: https://github.com/WolfWalter/dynamodb-onetable
Cut/Paste
Expected behavior
Environment (please complete the following information):