meteor js simpleschema Index with pattern already exists with different options

I've dropped the index in mongodb but am still getting the error when I restart my app. Anyone come across this ?

asked Jul 4, 2015 at 22:45 81 5 5 bronze badges

btw why set min and max again? regEx might be ok.. and probably you want to include A-Z too (or make it case insensitive: /^[a-z0-9]<3,32>$/i in addition.. is it a good idea to let usernames start with a number? you decide ;)

Commented Mar 11, 2016 at 23:57

2 Answers 2

Meteor comes with some default indexes on the users collections. From accounts-base:

/// DEFAULT INDEXES ON USERS Meteor.users._ensureIndex('username', ); Meteor.users._ensureIndex('emails.address', ); Meteor.users._ensureIndex('services.resume.loginTokens.hashedToken', ); Meteor.users._ensureIndex('services.resume.loginTokens.token', ); // For taking care of logoutOtherClients calls that crashed before the tokens // were deleted. Meteor.users._ensureIndex('services.resume.haveLoginTokensToDelete', < sparse: 1 >); // For expiring login tokens Meteor.users._ensureIndex("services.resume.loginTokens.when", < sparse: 1 >); 

I have not checked but I'm guessing unique: true may be the part of your schema that is conflicting with the above.