Microscope icon indicating copy to clipboard operation
Microscope copied to clipboard

fixtures.js needs startup function

Open MrPhilbert opened this issue 10 years ago • 1 comments

Going through this very well written book with friend.Figured out that this needs to be wrapped in a startup function:

Meteor.startup(function() { if (Posts.find().count() === 0) { Posts.insert({ title: 'Introducing Telescope', author: 'Sacha Greif', url: 'http://sachagreif.com/introducing-telescope/' }); Posts.insert({ title: 'Meteor', author: 'Tom Coleman', url: 'http://meteor.com' }); Posts.insert({ title: 'The Meteor Book', author: 'Tom Coleman', url: 'http://themeteorbook.com' }); } });

It seems that without it, the condition is not being looked at. Now the collection gets populated if empty.

MrPhilbert avatar Feb 28 '15 00:02 MrPhilbert

This worked

tdelam avatar Oct 10 '15 03:10 tdelam