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

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