I have a driver collection called bom which has
{
_id
name
parts: [{
partId : ObjectId(),
extras: {
quantity: 20,
notes: “”,
uom: “unit”
} }
]
}
the lookup collection is parts where i have part details
when i do lookup the field extras from part array of bom collection is lost
how do i just replace partId in the array from lookup collection abd maitain all others efficiantly
output i get
{
_id
name
parts: [{
part object from lookup,
}
]
}
output i want
{
_id
name
parts: [{
part object from lookup,
extras: {
quantity: 20,
notes: “”,
uom: “unit”
} }
]
}