Search code examples
mongodbmeteorminimongo

Meteor subscribe and publish permissions for indirect parameters


I am building a family tree and using a collection with people that denotes parents as an object with an array of the two id's as such { id: 1, name: "John Doe", parents: [3,4] } and can find ascendants and descendants. This collection could have thousands of people not related to each other so...

I only want to publish and automatically subscribe to only:

1 - direct ascendants and descendants (infinite levels) 2 - siblings (full and half) plus 1 level above and below from them 3 - uncles/aunts plus 1 level above and below from them

Additionally if I want to allow 2 levels from any of these )incase someone wants to browse siblings of a great grandfather for example) how would I do that? I have only used the very based of publish/subscribe and looked over the documentation but don't see how I can implement this.


Solution

  • https://github.com/svasva/meteor-publish-with-relations is a package to easily create relations between collections

    To avoid meteorite you can add it like

    meteor add mrt:publish-with-relations