I have this function that gets all the posts and I want to get the id of the post any idea how to get the id of the post or How to include the id when I add the document to
In my case, because I only want to get the data without subscribing to it, I'm adding the id in the then:
**If you want the data in a different object: **
await this.$fireStore
.collection('SOME_COLLECTION')
.doc('SOME_ID')
.get()
.then((item) => ({ id: item.id, data: item.data() }))
**If you want the data spread in the returned object: **
await this.$fireStore
.collection('SOME_COLLECTION')
.doc('SOME_ID')
.get()
.then((item) => ({ id: item.id, ...item.data() }))