Following is my user schema in user.js model -
var userSchema = new mongoose.Schema({
local: {
name: { type: String },
I had the same issue. Tried debugging different ways couldn't figure out. I tried dropping the collection and it worked fine after that. Although this is not a good solution if your collection has many documents. But if you are in the early state of development try dropping the collection.
db.users.drop();