dqk42179 2014-11-18 15:31
浏览 179

golang MongoDB聚合:返回不匹配的空对象

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条回答 默认 最新

    报告相同问题?