聚合mongoDB集合:通过第一个集合(映射),每个键都指向另一个集合ID

时间:2019-01-23 06:52:41

标签: mongodb mongodb-query

我仍然有一个 mongod noSQL ,如下所示:

db.bynder_jobs.aggregate([
  { $match: { campaignID: { $eq: "12087c22-260a-4fb8-834e-d231c4c277a3" } } },
  {
    $lookup: {
      localField: "presetID",
      from: "job_presets",
      foreignField: "ID",
      as: "joincollection"
    }
  },
  {
    $lookup: {
      localField: "createdByID",
      from: "users",
      foreignField: "ID",
      as: "joincollection2"
    }
  },
  {
    $lookup: {
      localField: "campaignID",
      from: "campaign",
      foreignField: "ID",
      as: "joincollection3"
    }
  },
  {
    $lookup: {
      localField: "campaignID",
      from: "campaign",
      foreignField: "ID",
      as: "joincollection3"
    }
  }
  //{"$lookup":{"localField":"jobMetaproperties","from":"campaign","foreignField":"ID","as":"joincollection3"}}
]);

我还有一个集合(AllMetaData),所以我想映射所有bynder_jobs。 jobMetaproperties(array)键指向AllMetaData id,并获取AllMetaData.lavel接受所有jobMetaproperties键。

0 个答案:

没有答案