I'm having trouble figuring out how to create unique key names for my online election app. Here is a typical set of relevant entities:
- 1 Election
- 5 Candidates
- 100,000 Voters
- up to 100,000 Votes
I need a unique key name for each Voter entity for the reasons expressed here. An email address would be unique for a voter in a particular election but not necessarily across multiple elections (since the same voter could be part of multiple elections).
If the Election was the parent entity of the voter entities, then using the voter email in combination with the election parent would be sufficient for a unique key. Since I need to use transactions in updating Voter entities (to make sure that a voter cannot vote more than once) I think I don't want to use an entity group because only one Voter could be updated at a time according to the docs.
Another solution could be to create a unique key for each voter of the form:
E<election ID>_<voter email>
e.g.,
E1001_john@example.com
Is that a reasonable way to create a unique key name for each Voter entity?