3👍
You need to do as follows:
this.pingu.votes++
pingu.set({
votes: this.pingu.votes
})
In addition, note that, to increment the value of a field, it is safer to use FieldValue.increment
, see https://firebase.googleblog.com/2019/03/increment-server-side-cloud-firestore.html and https://firebase.google.com/docs/reference/js/firebase.firestore.FieldValue#static-increment
- [Vuejs]-Variable still not defined even after adding external JS in VUE component
- [Vuejs]-I can't fetch data from Firebase to Vue
Source:stackexchange.com