-
Notifications
You must be signed in to change notification settings - Fork 15
Description
If I run the following update, the dots are expanded in the key (but dots in keys are perfectly valid in DDB). Whilst it'd be nice to be able to not expand dots using a configuration, it's highlighted some behaviour I'm not sure is correct.
If I use the dot notation,
{
"client": {
"test.dot": "foo"
}
}
The following update expression is created
{ UpdateExpression: 'SET #client.#test.#dot = :clienttestdot',
ExpressionAttributeNames: { '#client': 'client', '#test': 'test', '#dot': 'dot' },
ExpressionAttributeValues: { ':clienttestdot': 'foo' } }
Which fails if client.test doesn't already exist (It works fine if client.test.dot exists already)
The document path provided in the update expression is invalid for update
But if I structure the update per the below example
{
"client": {
"test": {
"dot": "foo"
}
}
}
This results in the following update expression which is clearly different to the previous one.
{ UpdateExpression: 'SET #client.#test = :clienttest',
ExpressionAttributeNames: { '#client': 'client', '#test': 'test' },
ExpressionAttributeValues: { ':clienttest': { dot: 'foo' } } }
This update works regardless of client.test existing prior to the update.
Is this expected behaviour?
Also, how might I save a key with a dot in it?