Merging array fields in MongoDB aggregation

前端 未结 2 1953
谎友^
谎友^ 2021-02-07 13:51

Is it possible to merge array fields in while using MongoDB aggregation framework? Here is a summary problem I am trying to solve:

Sample input documents for aggregation

2条回答
  •  感情败类
    2021-02-07 14:35

    As already mentioned in one of the comments, the simplest answer to the original question is to add preserveNullAndEmptyArrays to the $unwind stage.

提交回复
热议问题