This is my first crack at meteor so bear with me. I’m trying to create a collection for my menu system, so in /server/bootstrap.js, I have
Meteor.startup(function () { var Pages = new Meteor.Collection('Pages'); if(Pages.find().count() === 0) { Pages.insert( {'name': "Buildings", 'icon': "<i class='mdi-social-domain'></i>", 'route': 'buildings', 'include_in_menu': true, 'protected': false} ); Pages.insert( {'name': "Map", 'icon': "<i class='mdi-maps-pin-drop'></i>", 'route': 'map', 'include_in_menu': true, 'protected': false} ); Pages.insert( {'name': "Questions", 'icon': "Qu", 'route': 'questions', 'include_in_menu': true, 'protected': true} ); Pages.insert( {'name': "Aggregations", 'icon': "Ag", 'route': 'aggregations', 'include_in_menu': true, 'protected': true} ); Pages.insert( {'name': "Scenarios", 'icon': "Sc", 'route': 'scenarios', 'include_in_menu': true, 'protected': true} ); Pages.insert( {'name': "Users", 'icon': "<i class='mdi-social-group'></i>", 'route': 'users', 'include_in_menu': true, 'protected': true} ); } });
Then in /server/publish.js, I have:
Meteor.startup(function () { Meteor.publish("site_pages", function() { if(Roles.userIsInRole(this.userId, 'admin')) { return Pages.find(); } else { return Pages.find({ 'protected': false }); } }); });
Then in /my_app.js, I have:
Meteor.subscribe("site_pages");
At the console and in my code, ‘Pages’ is undefined. I know this is something simple, but it escapes me how I get access to my 6 Pages.