我的所有记录都有一个名为"图片"的字段.该字段是一个字符串数组.
我现在想要这个数组不为空的最新10条记录.
我已经google了一下,但奇怪的是我在这方面找不到多少.我已经阅读了$ where选项,但我想知道本机函数有多慢,以及是否有更好的解决方案.
即便如此,这不起作用:
ME.find({$where: 'this.pictures.length > 0'}).sort('-created').limit(10).execFind()
Run Code Online (Sandbox Code Playgroud)
什么都不返回 离开this.pictures没有长度位确实有效,但当然它也返回空记录.