I was following the documentation to simulate “joins” in publications in my application
Meteor.publish('Player.profile', function (playerId, gameId) {
check(playerId, String);
check(gameId, String);
// get player and the profile for a single game.
var player = Players.findOne(playerId);
var gameProfile = PlayerGames.find({
playerId: playerId,
gameId: gameId
});
if(player && gameProfile) {
return [
Players.find({ _id: playerId }),
Games.find({ _id: gameId }),
Guilds.find({ _id: gameProfile.guildId }),
Battlegroups.find({ _id: gameProfile.bgId })
]
} else {
this.error(404, "Player or player profile not found");
return;
}
});
Then in my route:
Router.map(function () {
this.route('Player.profile', {
path: '/player/:_id',
action: function () {
// some other stuff happens here
this.render('Player.profile', {
data: {
player: Players.findOne(),
games: Games.find(),
guild: Guilds.findOne(),
battlegroup: Battlegroups.findOne()
}
})
},
waitOn: function () {
return Meteor.subscribe('player', this.params._id, {
onError: function (error) {
Router.go('error', error);
}
})
}
});
});
However, it seems like whenever I edit my player profile, it does reactively update the player themselves, however, it does not seem to update the Games
or the Group
reactively on the page.
I go to an edit page, change the “games” the player is a part of, however, it does not seem to update correctly. If I look directly into the database, it seems to have changed, but not after being redirected to the page
Am I doing something wrong here?