-
Is there a way to increment a field value in either the firestore or realtime database? I know that the firestore has an increment method but it is on a FieldValue and I can't figure out how to make it work. https://firebase.google.com/docs/reference/js/firebase.firestore.FieldValue#increment |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
We are limited with the methods and functions that Firebase offers in the REST API. I looked again but the increment method is not available to us. In Firestore you can use the get() function to pull that data and, increment it, and then us update(). It adds a few steps but it will work. I just updated our Wiki yesterday with the Update function for Firestore. https://github.com/GodotNuts/GodotFirebase/wiki/Firestore#update-a-document I would have to ask some of the other members of the team about the RTD. |
Beta Was this translation helpful? Give feedback.
-
Just wanted to share, a long time later, that I implemented this by writing a firebase function that increments and just call that function. |
Beta Was this translation helpful? Give feedback.
@macktns
We are limited with the methods and functions that Firebase offers in the REST API. I looked again but the increment method is not available to us.
In Firestore you can use the get() function to pull that data and, increment it, and then us update(). It adds a few steps but it will work. I just updated our Wiki yesterday with the Update function for Firestore.
https://github.com/GodotNuts/GodotFirebase/wiki/Firestore#update-a-document
I would have to ask some of the other members of the team about the RTD.