This package looks like a god-send... but I'm a bit confused as to what I'm doing wrong. Hoping you might be able to point me in the right direction and clarify a couple of issues.
So, the end goal is to get tabular search working across multiple collections. We have a Responses collection, referencing both a contact and survey collection.
At the moment, my view looks like this...
DenormalizedViews.addView({
identifier: ident,
sourceCollection: Responses,
viewCollection: ResponsesView,
pick: ['created', 'comment', 'score', 'contact', 'survey'],
sync: {
contactCache: (response) => {
return Contacts.findOne({_id: response.contact});
},
surveyCache: (response) => {
return Surveys.findOne({_id: response.survey});
}
},
postSync: {
responseContact: (response) => {
const contact = response.contactCache.email;
return contact;
},
responseSurvey: (response) => {
const survey = response.surveyCache.name;
return survey;
}
}
});
I've also set up two refreshByCollections. Think I'm missing something, but just can't get anything beyond an empty cursor. To be frank, I haven't dug around too much in the code, so I'm probably just missing something really basic and hoping for a magic bullet. Two things I wasn't exactly sure about were the role of the identifier and the params on refreshByCollection, for example (doc, docPrevious, userId). Any pointers would be greatly appreciated! Thanks.