Articles → MONGODB → $Exists In Mongodb
$Exists In Mongodb
Purpose
Syntax
db.[collection_name].find(
{
[field]:{$exists:false
}
}) -- returns the document(s) that does that contain the field
db.[collection_name].find(
{
[field]:{$exists:true
}
}) -- returns the document(s) that contains the field
Example