Is there a way to get data from db, do stuff with it, and only then render template, using it?

When the app starts I want to get a bulk of data from the db, do stuff with it, and only when I finish render the view. Is it possible? I do not use iron router since it is a single page app.

Right now I have simply var data = Data.findOne({}) in client/main.js but the problem is that when I use data in a template, sometimes it is there but sometimes I get undefined. How do I make sure everything runs only when the data is there?

There is this really nice article explaning what I think you are looking for: template level subscriptions

1 Like