Performing a $lookup on Object Fields within an Array of Objects?

I’m trying to come up with an aggregation pipeline that will allow me to obtain some information from an enumerations collection which has a data structure of { _id, name, value }

My current document structure is as follows…

{
   name: "",
   description: "",
   events: [
     { actionType: ObjectId('...'), targetType: ObjectId('...') },
     { actionType: ObjectId('...'), targetType: ObjectId('...') }
   ]
}

Within the events array I need to take the fields and look them up against the enumeration collection and obtain the value of the looked-up document.

I can’t figure out how to do a $lookup for these though and replace the values in the arrays, the end result would be something like…

{
   name: "",
   description: "",
   events: [
     { actionType: 1, targetType: 64 },
     { actionType: 8, targetType: 128 }
   ]
}

I should add that while something along the lines of this…

{
  from: 'enumerations',
  localField: 'events.actionType',
  foreignField: '_id',
  as: 'events.actionType'
}

Seems to make sense to merge the document in-place of the ObjectId it completely overwrites the events array, and removes all elements.

Please provide some sample documents from both collections. It is much easier to help you when we do not have to type in documents that matches your descriptions.

@Christian_Tucker, any followup on this. If your issue is resolved please share the solution and mark it as such. This will help keeping this forum efficient because others will know how to solve a similar issue.