Kind of a weird question.
I added some custom fields to the user collection. I’m publishing them like so:
Meteor.publish('currentUser', function() {
if(this.userId) {
return Meteor.users.find({
_id: this.userId
}, {
fields: {
servers: 1,
games: 1,
profile: 1,
services: 1
}
})
} else {
this.ready();
}
});
I’m subscribing to the publication in the client’s main.js.
Meteor.subscribe('currentUser');
The first time Meteor.user()
is called, it doesn’t include the custom fields. All subsequent requests do.
As a result, I have to have a bunch of login in the frontend checking to see if the objects exist before using them.
Is there a way to ensure the fields will be present on the first request?