Meteor-Community-Packages / meteor-partitioner

Transparently divide a single meteor app into several different instances shared between different groups of users.
152 stars 18 forks source link

Meteor.users.findOne() can be an expensive db operation #32

Closed wildhart closed 1 year ago

wildhart commented 6 years ago

In grouping.coffee I suggest changing the line:

user = Meteor.users.findOne(userId})

to

user = Meteor.users.findOne(userId, {fields: groupId: 1, admin: 1})

so that the entire user object is not fetched from the database server. Applications may store significant amounts of extra data on the user object.

mizzao commented 6 years ago

Sure. If you make a PR I will merge it.

hzwzw commented 6 years ago

@mizzao I make a PR #34 , Please check.