I need to update a field in one collection using a field value from another collection. What is the best way to accomplish the following SQL in MongoDB 3.6?
update action a set serial_nr=(select serial_nr from device d where a.device_id=d.device_id);
Note the $set update operator will create a field called as serial_nr in the action's document, in case the field doesn’t exist (otherwise just replaces the existing value).