How to use $elemMatch on aggregate's projection?

前端 未结 7 1993
爱一瞬间的悲伤
爱一瞬间的悲伤 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:14

    Actually, the simplest solution is to just $unwind your array, then $match the appropriate documents. You can wind-up the appropriate documents again using $group and $push.

提交回复
热议问题