golang MongoDB aggregation: return empty objects for non-matches

458 views Asked by At

I have the below mgo code to get objects matching an array of IDs

pipeline := []bson.M{
        bson.M{"$match": bson.M{"gsm_id": bson.M{"$in": fixtureIDs }}},
  }

But, I would like to return an array of the form below where missing fixtureIDs are just empty objects:

[ {'gsm_id': 1223456, 
   'data': { ... obj ...}
  },
  {'gsm_id': 1234558,
   'data': {}}
]
0

There are 0 answers