In my Google Firebase setup, I have uniquely named each Map to serve as the index for every document. Using Vuejs (Javascript), I have structured it as follows:
eQFelbD432T (Collection Name- user.uid)
SKILLS (Document Name)
ProjectManangement (Map Name)
Rating: 4 (Key - Value Pair)
Experience: 2 (Key - Value Pair)
SystemEngneering (Map Name)
Rating: 6 (Key - Value Pair)
Experience: 2 (Key - Value Pair)
Now, I am trying to delete a specific map along with all its values, but I am struggling to figure out how to do so as there seems to be no direct way to target that particular map.
The code I currently have is as follows - however, it is not functioning correctly: The variable mapName contains the name of the map that needs to be deleted (e.g. ProjectManagement) provided by a function.
let ref = db.collection(this.$store.getters.getUserId).doc('SKILLS')
ref.get().then(doc => {
if (doc.exists) {
ref.update( { [mapName]: FieldValue.delete() } )
}
})
I'm hoping someone can assist me with this issue, or perhaps I am overlooking a simple solution...
Thank you and best regards