I'm trying to update a nested field in Firestore and I'm somehow overriding the entire object. A map of my data is shown below:
And I try to update rundate
and status
with this command:
//Assume deptName is extrusion
const item = await db.doc(`orders/${orderId}/batches/${batchNumber}`)
.update({
[`batchDeptStatusInfo.${deptName}`]: {
status:"Scheduled",
rundate: newRunDate,
}
})
However, this overwrites the entire object. As seen above, conversion
has four properties, while extrusion
(the property I tried to update) only has 2.
Can anyone provide some guidance on this issue? I've seen posts that say use dot notation and update
not set and I think I check those boxes
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…