Reputation: 676
I am trying to figure out how i would go about removing and adding to the profile array in the array of objects. I have the id's to get to the appropriate items in the arrays but it looks like i can only update the entire root array item.
doc().update({
technologyLearned: firebase.firestore.FieldValue.arrayRemove("?")
});
if this was a normal language i could technologyLearned[id].profiles[profileid] and get to the item i need to remove or add.
Upvotes: 2
Views: 534
Reputation: 317372
Since you can't index into an array to locate an item to remove, you will have to read the entire document, modify the array in memory, then write it back to the document.
The problem here is that technologiesLearned
is an array (not that profiles
is an array). If profiles
was not nested under technologiesLearned
array, you could use arrayRemove
on it.
Upvotes: 1