Database
[{"metadata":{"sensorId":"SENSOR_32"},"data":{"consumption":3.547,"powerOutput":21.282},"coef":{"SENSOR_32":1.2,"SENSOR_33":1.32,"SENSOR_34":1.62,"SENSOR_35":2.3,"SENSOR_36":2.47,"SENSOR_37":2.46,"SENSOR_38":1.62}}]
Query
db.collection.aggregate([{$set:{multiplied_consumption:{$multiply:[{$getField:{field:"v",input:{$first:{$filter:{input:{$objectToArray:"$coef"},cond:{$eq:["$$this.k","$metadata.sensorId"]}}}}}},"$data.consumption"]}}},{$merge:"collection"}])