How to use $elemMatch on aggregate's projection?

前端 未结 7 1968
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-01 15:27

This is my object:

{ \"_id\" : ObjectId(\"53fdcb6796cb9b9aa86f05b9\"), \"list\" : [ \"a\", \"b\" ], \"complist\" : [ { \"a\" : \"a\", \"b\" : \"b\" }, { \"a\         


        
相关标签:
7条回答
  • 2021-01-01 16:27

    For some reason $elemMatch doesn't work in aggregations. You need to use the new $filter operator in Mongo 3.2. See https://docs.mongodb.org/manual/reference/operator/aggregation/filter/

    0 讨论(0)
提交回复
热议问题