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:{coef_arr:{$objectToArray:"$coef"}}},{$set:{reqd_coef:{$first:{$filter:{input:"$coef_arr",cond:{$eq:["$$this.k","$metadata.sensorId"]}}}}}},{$set:{multiplied_consumption:{$multiply:["$reqd_coef.v","$data.consumption"]}}}])

Result