0

I am storing values in my dynamodb database in this format {"user_id":123456789,"user_xp_stats":{"user_level":15,"user_xp":12670}} After I request a get_item for specific user's "xp_stats" I get a object like this: { "M" : { "M" : { "user_level" : { "N" : "1" }, "user_xp" : { "N" : "8.1" } } }} How should I parse it?

Cloud Console screenshot

In other words, should I have it as a map or store "user_level" and "user_xp" each separately as a single value?

1 Answer 1

1

In other words, should I have it as a map or store "user_level" and "user_xp" each separately as a single value?

Its very difficult to make a call based on this one single example. If your items will usually have user_level and user_xp, I would keep it as separate attributes.

This gives your more options later on, e.g. you can create Global Secondary Indices later on based on these attributes. Its also easier to read and write as you noticed then a single map.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.