I'm working on a Vue,firebase app and I'm saving the userevents in a firebase collection, I update this userevents array when a user schedule an event and want to delete it when the user cancels or remove it,
users(collection) -
test123(document) -
"id" . --fields
"username" . --fields
"userevents" . --array
[0]
"eventid"
"date"
"desc"
"status"
[1]
"eventid"
"date"
"desc"
"status"
From UI, if the user cancels an event, I will have the eventid and want to delete it from the userevents array.
I tried removing the item from the array using below code, but it is deleting all the items from the userevents,
userRef.update({
eventid: firebase.firestore.FieldValue.delete()
});
Is there a way to achieve this in firebase?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…