0
votes

I have a KIND made up of USERS:

USER
    username<Key,String>
    friends <array of strings>

Two users can be friends (user can have many friends). If a users are friends both of their usernames are inside of each others 'friends' property. So if they become friends, I need to insert each usernames into the two entities and guarantee that they were both inserted and if there was an error or something it should be rolled back (All or nothing operation). Reading about transactions inside of Google Datastore from my understanding transactions can only be done within entitiy groups. Since these are two USER entities there is no parent/child relationship between them two, they are both root entities. What would be the best method to guarntee this operation goes through. The same would apply if a user was deleted, I would then need to delete that user from all the fiends properties of all the users who were friends with the deleted user and I must guarantee this.

1

1 Answers

2
votes

Datastore supports transactions involving multiple entity groups.