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
You could use the js spread operator and put that inside the query snapshot so using a bit of your code...
async get_the_posts(){
this.Post_collection = this.afs.collection('posts');
return this.Posts = await this.Post_collection.onSnapshot(querySnapshot =>{
let arr = []
querySnapshot.forEach(function (doc) {
arr.push({id:doc.id, ...doc.data()});
});
return arr
})
}