Ok. I'm using meteor, just meteor, no angular, no ionic. And I've come across some strange behavior: I have a user logged in, and I can log Meteor.user()
just fine, it comes back with all the correct properties as per the subscription. However, if I close my laptop, open it, and log Meteor.user()
again, I get only the _id and username properties, as if there was no subscription...
Here's my publication code on the server:
Meteor.publish('users', ()=>{
return Meteor.users.find({},{
sort:{
lName:1
},
fields:{
stats: 1,
skills: 1
}
})
})
and my subscription on the client, which may be the problem? It's a tad wonky:
const subs = ['Users', /*Other collections*/].map(a=>Meteor.subscribe(a.toLowerCase(), {
onReady: function(){console.log(`${a} Loaded:`, arguments)},
onError: function(){console.log(`${a} Error:`, arguments)},
onStop: function(){console.log(`${a} Stopped:`, arguments)}
}))
Neither onStop or onError are ever called. onReady calls once when the page is loaded. What is happening to my subscription? I remember once being able to log out all the active subscriptions, but can't remember exactly what it was. Is there a way to prevent this behavior, or a way to work around it? As it stands, my user ends up with no data, which is... unacceptable.
Edit: I was poking around more and more, and I finally found a concrete change in the data. Before I close my lid, Meteor.Users._collection.paused
is false. But after, it's true.
Mayhap this is a Mongo issue rather than a Meteor issue?