awslabs / dynamodb-data-mapper-js

A schema-based data mapper for Amazon DynamoDB.
https://awslabs.github.io/dynamodb-data-mapper-js/
Apache License 2.0
817 stars 106 forks source link

annotations: Add example of usage with Glboal Secondary Indexes #213

Open stefolog opened 2 years ago

stefolog commented 2 years ago

Issue #, if available: Right now there is very limited information on how to annotate properly the GSI related columns. In one of our projects previous devs did use the @hashKey annotation for columns that were part just of a GSI partition key, which is wrong and was causing problems that we spent quite some time to understand why it was happening.

Description of changes: This is adding one code example with two types of GSI indexes (hash and ranged) to the annotations README file. While it's not a full documentation, I feel it will be useful to have these basic examples that can guide the developers and save a lot of time in investigation.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.