How to check if a field exists in
MongoDB and it's value is not empty?
db.users.find({ profile_image: {$exists: 1, $ne: ""} }, { profile_image:1 })
NOTE:
$ne makes sure that field is not empty and $exists check whether field exist or not.
#mongodb #mongo #find #exists #ne