Reputation: 891
I need to use Firebase distributed counters with nuxt/firebase module.
Here is my code:
const increment = this.$fire.firestore.FieldValue.increment(1)
// some code
snapshot.docs[0].ref.update({ count: increment })
That worked well in the regular Vue app, but after migrating to NuxtJS, I'm getting this error:
TypeError: Cannot read property 'increment' of undefined
It seems like Nuxt Firebase doesn't support FieldValue.
Is there any chance to get it to work?
Upvotes: 0
Views: 460
Reputation: 891
I had to use $firemodule
This code worked:
const increment = this.$fireModule.firestore.FieldValue.increment(1)
snapshot.docs[0].ref.update({ count: increment })
https://firebase.nuxtjs.org/guide/usage/#firemodule
Upvotes: 4