vue-firestore
vue-firestore copied to clipboard
Adding the key for the first time
when you add a document for the first time you can not see the id in the firestore console, only you can see it when you update the doc.
HI @hsouiri97 can you provide an example?
@amranidev when we call this function this.$firestore.persons.add()
for the first time we can save the object in firestore however we can not see the id or ".key"
value in firestore console, but if we looped trough the list of objects in our application and console log them we can see that they have and id
value, so then if we call this.$firestore.persons.doc(person['.key']).update()
we can see that the ".key"
value has been added to firestore console.
1. Adding the object with this.$firestore.persons.add()
2. Looping through the objects and console log them so we can see the id value:
3. Calling the this.$firestore.persons.doc(person['.key']).update()
function and checking the firestore console to see that the id has been added
Note that I used this Vue.use(VueFirestore, { key: 'id', enumerable: true })
to customize the name of the .key
property.