How to match by 'undefined' value in MongoDB Aggregation Framework?

前端 未结 3 649
走了就别回头了
走了就别回头了 2021-01-17 08:40

How can I search for the records filtering in a field that has an undefined value:

db.records.aggregate({
    $match: {
               


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-17 09:38

    Filter it by $type:6, (mongodb referece, note that this type marked as 'deprecated'):

    db.records.aggregate({
        $match: {
            myField: {'$type':6},
        }
    })
    

提交回复
热议问题