clarkie / dynogels

DynamoDB data mapper for node.js. Originally forked from https://github.com/ryanfitz/vogels
Other
490 stars 110 forks source link

prevent overwriting based on global secondary index #31

Closed edupre closed 7 years ago

edupre commented 8 years ago

Hello, My understanding is that {overwrite : false} prevents overwriting only based on the partition key.

When I create an object with a generated partition key (uuid), how can I prevent overwriting based on another attribute (for instance, an email address) ? Note that this attribute could be a global secondary index.

Thanks!

clarkie commented 7 years ago

Unfortunately this isn't realistic with DynamoDB. The best approach is to use the email address as the hashkey. This is the only way to guarantee uniqueness with dynamodb.

clarkie commented 7 years ago

For more information on conditional writes please see #32