MongoDB aggregate by field exists

前端 未结 6 1437
不思量自难忘°
不思量自难忘° 2020-12-02 12:33

I have a hard time believing this question hasn\'t been asked and answered somewhere already, but I can\'t find any trace of it.

I have a MongoDB aggregation query t

6条回答
  •  执笔经年
    2020-12-02 12:56

    Dunno how it was but now in 2019 there is clean solution. In aggregation pipeline do this

    $match: {"my_field": {$ne: null}}
    

    Nice thing is in my lang 'ne' means not :)

提交回复
热议问题