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

1.1K    Asked by AnkitChauhan in Python , Asked on Jul 12, 2021

I would like to execute the following query:

db.mycollection.find(HAS IMAGE URL)

What should be the correct syntax?

Answered by Behailu

The query for mongodb not null in pymongo you can use the following query:-

  db.mycollection.find({"IMAGE URL":{"$ne":None}});

This is because pymongo represents mongo "null" as python "None".



Your Answer

Interviews

Parent Categories