Accepted answer

First, you shouldn't use findOne in your publication - publications should return a cursor; in this case you will be publishing a single-document cursor (as long as only a single document in Groups matches the query). Just use find in the publication.

Second, when you're fetching the data on the client, you should make your query appropriately specific. Currently you're fetching all groups to which your client is subscribed (presumably you have other publications and subscriptions running.) See here for the Meteor Guide's advice. You'll want to do something like this in your container:

return {
  group: Groups.findOne({
    code: Meteor.users.findOne(this.userId).profile.selectedGroup

Finally, if your user's selectedGroup can change, you should be aware that the data that publications provide can change, but their queries can't. So if your user's selectedGroup changes, the publication won't reflect this - as its query won't change. See here. So you will want to use the reactive publish package to deal with this.

Related Query

More Query from same tag