I have a simple app that will not allow me to see data ddp data when editing. I am able to add without n issue. Here a simple snippet.
/client/config/router/
Router.route('/editLoyaltyCampaign/:_id', {
name: 'editLoyaltyCampaign',
data: function(){
console.log(LoyaltyInstantReward.findOne({_id: this.params._id})); //returns undefined.
return LoyaltyInstantReward.findOne({_id: this.params._id});
},
onBeforeAction: function(){
var currentUser = Meteor.userId();
if(currentUser){
this.next();
} else {
this.render("loginTwo");
}
},
subscriptions: function(){
return Meteor.subscribe('LoyaltyInstantReward');
}
});
//both/collection/
LoyaltyInstantReward = new Mongo.Collection('loyaltyinstantreward');
if (Meteor.isServer) {
Meteor.publish(LoyaltyInstantReward, function () {
var v = LoyaltyInstantReward.find();
return v;
});
}
var LoyaltyInstantRewardSchema = new SimpleSchema({
//fields here
});
LoyaltyInstantReward.attachSchema( LoyaltyInstantRewardSchema );
Any one can tell what I am doing wrong. I am really a newbie to meteor.