Mongdb非空数组查询
db.idap_zl.insert({array:[]})
db.idap_zl.insert({array:[1,2,3,4,5]})
db.idap_zl.find({array:{$elemMatch:{$ne:null}}})
一、elemMatch和elemMatch和ne
db.Collection.find({array:{$elemMatch:{$ne:null}}})
二、$where
db.Collection.find({$where:"this.array.length>0"})
三、not和not和size
db.Collection.find({array: {$not: {$size: 0}}})
四、'.'路径和$exists
db.Collection.find({{'array.0': {$exists: 1}}})
五、exists和exists和ne
db.Collection.find({ array: { $exists: true, $ne: [] } })
六、$gt
db.Collection.find({ array: { $gt: [] } })