Subscription not ready / CollectionFS?


Hey guys,
I’m using Iron Router’s waitOn to wait until my subscription is ready. This is my code:

Router.route('/me', {
name: 'me',
data: function() { return Meteor.user(); },
waitOn: function() { return Meteor.subscribe('myPictures'); }

Now I’m initializing in my template some jQuery plugins, to show a photo browser:

Template.myPictured.onRendered(function() {

myImages = Images.find({owner: Meteor.userId()}).fetch();


My problem: I get an empty array. If I execute the commands with a timeout of 1 second, it works fine. Why is the data of the subscription not available although I wait until the subscription is ready?

//Edit: I see that’s an CollectionFS issue. When I do the find() in my onRendered method, the Images objects aren’t transformed and my field owner isn’t available. If I wait 1 seconds, all Image object are transformed and my field owner is available. Is there an event when transformation has finished?


Okay, I see thats an CollectionFS issue, is there any callback when the transformation is done?


Check code, maybe a Misspell???


Nope, that wasn’t the problem. Images are a CollectionFS collection, so when I do console.log(Images.find({owner: Meteor.userId()}).fetch()) I have no field ‘owner’ available and createdByTransform is false. If I wait 1 second, the field is available and createdByTransform is set to true. So it seems that I need to check when the transform is finished?


Your not waiting, ur just saying to the router to wait for the data, but in the template you actually have to wait for that data.

if im not mistaken you have to use something like this

{{#if Template.subscriptionsReady}}