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