加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 服务器 > 系统 > 正文

mongodb查找size大于1的内嵌list的document

发布时间:2023-10-18 15:33:50 所属栏目:系统 来源:
导读:db.user_profile.find({ $where: "this.disk_rack.length > 1" } )

但是这种js引擎执行的会非常慢

更好的办法是

CreateextrafieldNamesArrayLength, update it with names array length and then use in
db.user_profile.find({ $where: "this.disk_rack.length > 1" } )
 
但是这种js引擎执行的会非常慢
 
更好的办法是
 
CreateextrafieldNamesArrayLength, update it with names array length and then use in queries:
 
db.accommodations.find({"NamesArrayLength": {$gt: 1} });
 
复制代码
 
It will be better solution, and will work much faster (you can create index on it).
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章