Taking an ID from a collection to get data from another collection

Viewing a post with a list of other posts that have somekind of relationship with it.

So far I have TemplateA which takes data from iron router from CollectionA. This all works fine. I see everything I need from the CollectionA.

I use an each loop to make another CollectionB which has lines that match an ID from CollectionA. If a document matches the ID from CollectionA, I want to see this new id from Collection. So far this gets me a list of different IDs from collectionB. I use TemplateB to print this IDs.

  • ID1
  • ID2
  • ID3

So what I want is to take those new IDs from CollectionB, and put a search CollectionA for posts with those IDs, and use the data from CollectionA to use the names and links to TemplateA again with new data.

  • Link to post1
  • Link to post2
  • Link to post3
{{#with collectionA}}



collectionA: function () {
return CollectionA.find({_id: this.idB});

Help be super appreciated. Am I being clear?


Use findOne instead.