Fix email verification token index

The original index, "emails.validationTokens.token" is never used in any meteor packages.  A search of "validationTokens" across all the packages in `meteor/packages` returns nothing.

The correct index should be, "services.email.verificationTokens.token".  This is used in the `verifyEmail` method to locate the correct user record.  Without a matching index, this causes a full table scan each time `verifyEmail` is called.

Fixes #4482.
This commit is contained in:
Adrian Lanning
2015-05-31 00:25:04 -04:00
committed by David Glasser
parent 4eb017a4ab
commit 9f2c35e253
2 changed files with 5 additions and 1 deletions

View File

@@ -100,6 +100,10 @@
`AccountsServer` constructors, so that users can create multiple
independent instances of the `Accounts` namespace. #4233
* Create an index for `Meteor.users` on
`services.email.verificationTokens.token` (instead of
`emails.validationTokens.token`, which never was used for anything). #4482
### Minimongo
* The `$push` query modifier now supports a `$position` argument. #4312

View File

@@ -779,7 +779,7 @@ Accounts.createUser = function (options, callback) {
///
/// PASSWORD-SPECIFIC INDEXES ON USERS
///
Meteor.users._ensureIndex('emails.validationTokens.token',
Meteor.users._ensureIndex('services.email.verificationTokens.token',
{unique: 1, sparse: 1});
Meteor.users._ensureIndex('services.password.reset.token',
{unique: 1, sparse: 1});