原文链接:
-
https://www.tutorialspoint.com/check-if-a-list-is-not-empty-in-mongodb
-
https://stackoverflow.com/questions/14789684/find-mongodb-records-where-array-field-is-not-empty
有两种查询语法:
- 语法 1 :
xxx.find({'xxx': {'$not': {'$size': 0}}})
- 语法 2 :
xxx.find({'xxx': { $exists: true, $ne: [] }})
用中文查了下没查到想要的结果,无奈只能用 bing 查了,前两条内容就是我想要的内容,两种方式都可以。