首页 > 数据库技术 > 详细

MongoDB中多表关联查询(

时间:2019-02-15 15:40:20      阅读:176      评论:0      收藏:0      [点我收藏+]

1.使用aggregate 查看表数据

     
db.getCollection(reports).aggregate([
   {
     $lookup:
       {
         from: "process",
         localField: "sid",
         foreignField: "sid",
         as: "docs"
       }
      },
        {$match:{"industry_info.oid":21,sync:2}},
        {$project:{"docs":1}}
])

 

 

 

 

 

 

 

 

 

 

参考资料:https://www.cnblogs.com/huangxincheng/p/5728791.html

MongoDB中多表关联查询(

原文:https://www.cnblogs.com/myvic/p/10383910.html

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