一、$elemMatch和$ne

db.Collection.find({array:{$elemMatch:{$ne:null}}})

二、$where

db.Collection.find({$where:"this.array.length>0"})

三、$not和$size

db.Collection.find({array: {$not: {$size: 0}}})

四、'.'路径和$exists

db.Collection.find({{'array.0': {$exists: 1}}})

五、$exists和$ne

db.Collection.find({ array: { $exists: true, $ne: [] } })

六、$gt

db.Collection.find({ array: { $gt: [] } })

 

相关文章:

  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-25
  • 2022-02-08
  • 2022-01-19
  • 2021-08-21
猜你喜欢
  • 2022-12-23
  • 2021-05-17
  • 2021-07-24
  • 2022-12-23
  • 1970-01-01
  • 2021-12-06
  • 2022-01-17
相关资源
相似解决方案