How do you query for “is not null” in Mongo?

后端 未结 10 2272
暖寄归人
暖寄归人 2020-11-30 15:59

I would like to execute a following query:

db.mycollection.find(HAS IMAGE URL)

What should be the correct syntax?

10条回答
  •  旧巷少年郎
    2020-11-30 17:05

    Sharing for future readers.

    This query worked for us (query executed from MongoDB compass):

    {
      "fieldName": {
        "$nin": [
          "",
          null
        ]
      }
    }
    

提交回复
热议问题