0

I would like to know if the username, email addresses and profile name of the Meteor.users collection are indexed if not is there a way to index them ?

does it cost much to run regex on this field without them being indexed ?

  • a general way to list indexes on a collections is using mongo's [getIndexes](http://docs.mongodb.org/manual/reference/method/db.collection.getIndexes/#db.collection.getIndexes) – Bogdan D Jan 13 '15 at 16:30

1 Answers1

3

These are the indexes Meteor currently ensures on the users collection -- from accounts_server.js

/// DEFAULT INDEXES ON USERS
Meteor.users._ensureIndex('username', {unique: 1, sparse: 1});
Meteor.users._ensureIndex('emails.address', {unique: 1, sparse: 1});
Meteor.users._ensureIndex('services.resume.loginTokens.token',
                        {unique: 1, sparse: 1});
TimDog
  • 8,758
  • 5
  • 41
  • 50