google cloud datastore - Modeling an invite schema with embedded collections with dynamodb or docuemntdb -


i'm investigating whether use aws dynamodb or azure documentdb or google cloud price , simplicity app , wondering best approach typical invite schema.

an invite has

  • userid : key (who created invite)
  • gameid : key
  • invitationlist : collection of userids

the queries running are

  1. get invites userid == me
  2. get invites userid in invitationlist

in mongo, set index on embedded invitationlist, , in sql set join table of gameid , invited userids.

using dynamodb or documentdb, in 1 "table" or have set second denormalized table 1 has invited userid per row set of invitedgameids?

e.g.

a secondary table with

  • inviteduserid : key
  • gameids : collection

similar hslriksen's answer, if criteria met, recommend denormalize of single document. criteria are:

  1. the invitationlist games cannot grow unbounded.
  2. even if it's bounded, maximum length array fit in document , transaction limits.

however, different hslriksen, recommend example document this:

{   gameid: <some game key>,   userid: <some user id>,   invitationlist: [<user id 1>, <user id 2>, ...] } 

you might decide use built-in id field games in case name above wrong.

the key difference between propose , hslriksen invitationslist pure array of foreign keys. allow indexes used array_contains clause in query.

note, in documentdb, tend store entity types in same big bucket , distinguish them string type field or better, is_my_type boolean field.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -