Hi there,
According to my Kadira Publications Breakdown, the below subscription/publication has the slowest response time (500ms - 1s). It also happens to be the most-subscribed.
The publication accomplishes the same thing as Meteor.user(), but allows me to access fields that aren’t made public by default, including a registered_email field. I would have expected this to be one of the quicker subscriptions, but the opposite seems to be true. For context, there are ~2,300 users.
This is the subscription.
getMeteorData() {
var data = {}
var handle = Meteor.subscribe('current-user')
if (Meteor.user() && handle.ready()) {
data.user = Meteor.user()
}
return data
},
This is the publication.
Meteor.publish('current-user', function publishFunction(query) {
return Meteor.users.find(
{_id: this.userId},
{fields:{_id:1,registered_emails:1}}
)
})
The collection is indexed by _id (as is default). Is it normal for it to be one of the slowest queries? As I said, I’d have expected this to be one of the fastest.