I'm trying to update nested object in google's Firebase Cloud Firestore.
My database structure is:
collection 'users'
-- documents (userId)
---- collection 'matrix
------ document 'service' (got more documents: same type different names)
-------- success: Story[]
-------- failure: Story[]
-------- name: string
Story Model:
title: string
text: string
storyType: string ('success' | 'failure)
case: string (for instance 'service')
...
now I'm using Angular and I want to update a single story using. How do I do that?
I know how to get the reference to the 'service' document
update(story: Story, userId:string){ }
db.collection('users').doc(userId).collection('matrix).doc(story.case).update()
Do i need to update the whole document or can I reach the specific story by the story object (I know his type for instance 'success' and title is uniq) so I can search which has this title and update only this story?