Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixtures.js needs startup function #6

Open
MrPhilbert opened this issue Feb 28, 2015 · 1 comment
Open

fixtures.js needs startup function #6

MrPhilbert opened this issue Feb 28, 2015 · 1 comment

Comments

@MrPhilbert
Copy link

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 MrPhilbert changed the title fixtures.js need startup function fixtures.js needs startup function Feb 28, 2015
@tdelam
Copy link

tdelam commented Oct 10, 2015

This worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants