首页 > 数据库技术 > 详细

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

时间:2014-02-07 00:40:18      阅读:1221      评论:0      收藏:0      [点我收藏+]
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).


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

原文:http://lonelyprogram.blog.51cto.com/6246243/1355271

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!