How to join collection outside of MongoDB


#1

Hello I tried to ask this on StackOverflow but got no answer.

Surprised as well I couldn’t find much on the subject. I would like to know what is the best way to retrieve from a Collection A something from Collection B via an array of _id.

Here’s my question on StackOverflow : http://stackoverflow.com/questions/38444176/using-transform-function-in-new-mongo-collection-that-uses-other-collection-alwa

Thank you in advance.


#2

As long as “outside of MongoDB” means “inside of Meteor”, you could look at reywood:publish-composite.


#3

Thank you, this seems to work.

I thought this would be doable without a package.

Is this the normal way to do it? Or is it better to store the whole Collection B item in the Collection A (having an array of Collection B item instead of _ids)? This would require hooks on the Collection B to update the items in the arrays of Collection A on Update Delete…