Database: Please add Push function into MutableData
See original GitHub issueWhen I use RunTransaction
function I would like to add child node like I could normally push. For simplicity the MutableData
should also have Push
that would generate it’s key in transaction
Is it possible?
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (10 by maintainers)
Top Results From Across the Web
Database: Please add Push function into MutableData #275
When I use RunTransaction function I would like to add child node like I could normally push. For simplicity the MutableData should also ......
Read more >Firebase Realtime Database add to list in MutableData
How can I add to a list in a Firebase Realtime Database transaction using MutableData? ... DatabaseReference refDatabase = ... refDatabase.push().
Read more >database package - JavaScript API reference - Firebase
This is the most common pattern for adding data to a collection of items.If you provide a value to push() , the value...
Read more >Saving Data | Firebase Realtime Database - Google
Ways to Save Data ; push, Add to a list of data in the database. Every time you push a new node onto...
Read more >Firebase Database problem
Hello, So I have a game with the mainMenu scene and Play scene. After I log in with LoginButton() the Text: usernameText is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Thaina You are correct that if both client is trying to push
{ "newUniqueKey" : { "before" : null,"after" : newValue } }
, the later one would be rejected and need to rerun the transaction again.It is almost impossible to generate the same unique key using Push() in the second round-trip, assuming the timestamp calculated on all client is correct. If you want to 100% certain about 0 collision, you can always to check if the value at “newUniqueKey” is empty or not.
I can see your point to add Push() to MutableData. I can forward your opinion to the team. Since this API does not exists in iOS/Android SDK, we cannot simply add this to Unity SDK. https://firebase.google.com/docs/reference/android/com/google/firebase/database/MutableData
At the meantime, you can always use Push() from the captured DatabaseReference.
Hope this helps! Shawn
@chkuang-g Thank you very much
I don’t require that it must be implemented like I have state above. But the
MutableData
in transation should have some api that could do this same functionality I wish more easily