So I had a model User with username
and password
fields. Later I changed it to use email instead of username. A similar change was made on another model - I renamed username
to name
. Both fields used unique validation from mongoose-unique-validator
. Now, whenever I start the server, the mongoose created indexes for all fields, old and new. The first and the last things do not exist in the schemas anymore:
Mongoose: users.ensureIndex({ username: 1 }, { unique: true, background: true })
Mongoose: people.ensureIndex({ name: 1 }, { unique: true, background: true })
Mongoose: people.ensureIndex({ uri: 1 }, { unique: true, background: true })
Mongoose: people.ensureIndex({ username: 1 }, { unique: true, background: true })
Dropping database did not help, changing database did not help. I really do not understand where it might be coming from. Is there some sort of caching in mongoose?