For example, in a game, I want to store a player's progress information.
This user data is stored first:
{ "Worlds": [ { "Id": 1, "Levels": [ { "Id": 1, "Progress": 0 }, { "Id": 2, "Progress": 0 } ] }, { "Id": 2, "Levels": [ { "Id": 1, "Progress": 0 }, { "Id": 2, "Progress": 0 } ] } ] }
When he progresses, I would like to send this information to update only the progress of World 1 - Level 1
{ "Worlds": [ { "Id": 1, "Levels": [ { "Id": 1, "Progress": 500 } ] } ] }
Is it possible to achieve this result without having to get all the data from the server?
{ "Worlds": [ { "Id": 1, "Levels": [ { "Id": 1, "Progress": 500 <-- value updated }, { "Id": 2, "Progress": 0 } ] }, { "Id": 2, "Levels": [ { "Id": 1, "Progress": 0 }, { "Id": 2, "Progress": 0 } ] } ] }
Answer by Gosen Gao · Sep 06, 2021 at 09:04 AM
To clarify, the smallest unit to update User Data is one K/V pair. The value of one K/V pair can’t be updated in parts but can only be updated by overwriting. But as a workaround, you can get all the data first, and store it locally. Every time player progresses, you can just modify part of it then call update API with it.