Given I have 3 types of collections and a dynamic value, how would I specify what collection to search for based on that dynamic value?
E.g,
array = [
{id: 'one', type: 'profile'},
{id: 'something', type: 'post'},
{id: 'askjdaksj', type: 'comment']
]
How would I isolate the type and turn it into a collection? Basically turning type into Collection.find
array[0].type.find({_id: id});
=> Profiles.find({_id: id});
Is this possible?