MongoDB中多表关联查询(

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

posted @ 2019-02-15 15:30  myvic  阅读(4044)  评论(0编辑  收藏  举报