mongodb array size not empty code example
Example 1: mongodb check for array not empty query
collection.find({ arrayElementName: { $exists: true, $not: {$size: 0} } })
Example 2: mongodb empty an array field
db.collection.update({}, { $set : {'myArray': [] }} , {multi:true} )