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