question

jeffsherin avatar image
jeffsherin asked

Retrieving a character based on character data

In our game, each user can have multiple characters. Each character has a unique id we store in character data (cardID).

key: 'CardID', value: 12345

We need to be able to retrieve a character from just that cardID. Is that possible?

So for example, we are getting an update that cardID 12345 should get 10 points. We do not have the associated user.

Character DataCharacters
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

In general, database lookups use indices in order to make finding a given record efficient. A data system where you could look up a record based upon any arbitrary value within that record would be much more expensive to run, as it would require full table scans for each lookup. So no, it's not possible to look up a character by the value of a key/value pair within the character.

But can you explain your design in more detail? If the user is the owner of the characters, why would you not know who the user is?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.