1

Please consider the following MongoDB query result as the example:

{
     "name": "Joe Soap",
     "gender": "male",
     "employee_no: 123245678,
     "jobs": [
         {
             "name": "Defy washing machine repair",
             "spares": 569f6d002e16e55f2f8958d9,
         },
         {
             "name": "Samsung fridge regas",
             "spares": 569f6d002e16e55f2f8958e4,
         }
     ]
}

So the jobs field has an array of documents. I'm trying to run $lookup on the spares values (the ids of documents in a "spares" collection) inside each array element.

Is this possible with aggregate? If not, any suggestions how I could exact a join like operation to link the "spares" to this collection query?

Neil Lunn
  • 148,042
  • 36
  • 346
  • 317
O_O
  • 13
  • 3

0 Answers0