mongodb query to check empty array

92

mongodb query to check empty array -

collection.find({ arrayElementName: { $exists: true, $not: {$size: 0} } })

mongodb empty an array field -

db.collection.update({}, { $set : {'myArray': [] }} , {multi:true} )

Comments

Submit
0 Comments