Reputation: 1063
Pretty new to Meteor and I've been running into errors updating my mongoDB meteor collections ever since removing autopublish. Maybe I'm missing something very crucial about publishing now, but just typing into the console:
NVC.Users.insert({name:'bob'})
--> "MTi5ePEyHyKXZFWjL"
NVC.Users.find().fetch()
--> []
throws me off since before removing autopublish I could have sworn that this worked. Could somebody please explain what I'm missing, as I've also tried:
// Client
if Meteor.isClient
Deps.autorun ->
Meteor.subscribe 'rooms'
// Server
if Meteor.isServer
Meteor.startup ->
Meteor.publish 'rooms' , ->
return Rooms.find()
Upvotes: 0
Views: 466
Reputation: 75975
Don't put your subscribe in a Deps.autorun
:
if Meteor.isClient
Meteor.subscribe 'rooms'
Use Deps.autorun if you would like to change the subscription by passing it a variable via Session
, but in the use case above you do not need it.
Deps.autorun runs every time a reactive dependency in it changes. But there aren't any so it doesn't run and makes no subscription to rooms
Upvotes: 1