I have a problem with deleting an Object
out of an Array
in firestore
.
I have this data in firestore:
And now I would like to delete e.g the second Object
out of the posts Array
.
Code:
deletePic () {
let docId = `${this.currentUser.uid}`
fb.usersCollection.doc(docId).update({
posts: firebase.firestore.FieldValue.arrayRemove()
})
.catch(function(error) {
console.error("Error removing document: ", error);
});
}
But I do not know how to define arrayRemove()
These are the pictures and each one has a delete button to delete the picture.