Hi everybody,
I recently tried publishing custom, filtered data (For the time being, it is just a completely fake pre-written set of data) by using this.added and this.ready in a meteor publication.
However, the client’s collection I am aiming to put the data into doesn’t update and stays empty. Any ideas on what I am doing wrong? Here the code, very simple:
Meteor.publish('suggestions', function(query){
if(query == "") {
var a = fakesuggestion1();
var b = fakesuggestion2();
var c = fakesuggestion3();
this.added('Suggestions', a._id, a);
this.added('Suggestions', b._id, b);
this.added('Suggestions', c._id, c);
this.ready();
} else {
return Suggestions.find({name: query});
}
});
function fakesuggestion1(){return {_id: 'test', somethingelse: 'blabla'};}
...
On the client side, I am using a very simply subscription.
Tracker.autorun(() => {
Meteor.subscribe("suggestions", searchValue);
});
Which should update the Suggestions collection.
However, querying Suggestions.find().fetch() at any time doesn’t result in anything. Why is that?
Thank you for your time!