Path to a Dictionary Key #418
Unanswered
AquaDragon33
asked this question in
Q&A
Replies: 1 comment 9 replies
-
Hm. I'll test something. I think we can simplify your data structure and it'll make it much easier, but have to test it out. |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, as usual, thanks for the work you've done to keep this updated.
My question: is it possible to selectively update a single element in the dictionary stored on Firebase?
In a game I'm working on, there is a dictionary I have that has hundreds of keys within it
word_experience: {가다: 6, 거기: 3, 기다리다: 1, 네: 6, 대: 6, 둘: 1, 먹다: 3, 멈추다: 3, 물: 28...
Updating on Firestore hasn't been a problem, as I basically do the equivalent of:
document.add_or_update_field(word_experience, {가다: 6, 거기: 3, 기다리다: 1, 네: 6, 대: 6, 둘: 1, 먹다: 3, 멈추다: 3, 물: 28...)
However, because there are multiple dictionaries like this and because saving happens so frequently, it stutters the game slightly when saving while sending the whole set of dictionaries. Therefore, instead of sending the whole dictionary, I'd like to only send the section that changed without sending the whole dictionary. For example,
document.add_or_update_field(word_experience, {가다: 50})
However, this outright replaces the dictionary that has been saved under the category, which is word_experience in this case. So I'm wondering if I can do something like this:
document.add_or_update_field(word_experience.가다, 50)
Where only the single key within word_experience is updated? I've rifled through the wiki and through Firebase documentation, but I'm unsure how to do something like this, or indeed whether it's possible. As always, thank you for your time.
Beta Was this translation helpful? Give feedback.
All reactions