How to join (?) two collections the easiest way


#1

I have a google map search that returns the place_id of a city once typed in a search box.

This ID returns something like this:

cityid: 'ChIJAe2gZALJlzMRzsoweNVuBis', data: [ { ... },

Early edit …spacebar submits messages here what lol?

Now I have several cities like this in my collection as documents. However, there’s one city that you can search for on google maps that contains all of the ‘smaller’ cities So if this certain ID gets returned with the google search, i need to get all those fields in ‘data’: and have it returned together. Is there a simple way to do this in meteor/mongo?


#2

With regards to your general query there’s ‘Publish Composite’ - a package used for creating reactive joins.


#3

https://www.discovermeteor.com/blog/reactive-joins-in-meteor/