I have been working with this problem for 1 hour already and I cannot be any more frustrated than this.
Categories = new Mongo.Collection('categories');
if (Categories.find().count === 0) {
var categories = [
{
category: 'Medicine',
},
{
category: 'Agriculture',
},
{
category: 'Food',
},
{
category: 'Industrial',
},
{
category: 'Agriculture',
},
];
_.each(categories, function (category) {
var id;
id = Categories.insert({
category: category.category,
sub: []
});
});
};
Am I doing something wrong?
It's pretty much straight forward.. But it seems its not working..
Update: When I start the server in localhost:3000/
no collection of 'categories' is being made, and fixtures is not adding.
Other fixtures such as Meteor.users
is working though...
I think you want:
if (Categories.find().count() === 0) {
instead of:
if (Categories.find().count === 0) {