I have a a map within a firestore document that looks like this:
Right now I am confused on how to:
- Update the value of the one item in the map
- Add a new value to the map
I thought Update() would be my best option based on the documentation:
Set() in firestore:
To create or overwrite a single document, use the set() method:
Update() in firestore:
To update some fields of a document without overwriting the entire document, use the update() method:
So I want to update just my inPack map. I am doing that with this code:
db
.collection('GearLockerItems')
.doc(doc.reference.id)
.update(
{
'inPack': {packID: false},
},
);
My issue is that it is overwriting the valueId and not adding a new valueID. So I am updating the inPack by overwriting the entire thing. I think I am not getting down to the next level and am stuck.