array exist true and field empty in mongodb code example
Example 1: mongodb exists and not null
db.collection1.find({ 'fieldname1' : { $exists: true, $ne: null } });
Example 2: mongodb filter empty array
db.collection.find({arrayElementName : {$exists:true, $size:0}})