Calling this.ready on custom data does not update client's collection?

#1

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!

#2

Nevermind, my bad. My mongo collection was registered as lowercase suggestions, and I used added on uppercase Suggestions …

#3

One different but related question I had as well though, was how to make the collection data reset with every subscription change?

Depending on the arguments to my subscription above (The query), I’d like to either return my modified data OR direct real data, but never both at the same time, since I’m always using the 3 first results, which results in the modified data staying on my page forever…