meteor-joins icon indicating copy to clipboard operation
meteor-joins copied to clipboard

For a simple join, how do you use an array as the foreign key ?

Open tried2call opened this issue 9 years ago • 2 comments

Based on your example of a simple join between two collections: My foreign key is an array of several values (actually several Mongo _id fields). How can I use this multi-value array and link to multiple documents in the 'linked-to' file ?

It seems that I would need to loop-thru this array somehow to make these linkages.

Thanks !

tried2call avatar Jan 20 '16 03:01 tried2call

@tried2call sorry, package cannot do that automatically.

perak avatar Jan 20 '16 05:01 perak

@perak I have the same case, let's assume my company collection looks like below

{
    _id : "dYo4tqpZms9j8aG4C"
    owner : "yjzakAgYWejmJcuHz"
    name : "Labbaik Waters"
    peoples : ["yjzakAgYWejmJcuHz", "yjzakAgYWejmJcuHz"],
    createdAt: "2019-09-18T15:33:29.952+00:00"
}

here you can see peoples field contains the user ID's so How I publish this userId's as user Documents, it package support it? @tried2call have you solved your issue, any workaround

raza2022 avatar Sep 21 '19 08:09 raza2022