Following is my user schema in user.js model -
var userSchema = new mongoose.Schema({
local: {
name: { type: String },
I was facing similar issue, I went about clearing idexes and restarting server and probably almost everything mentioned here according to my understanding and still there was error, turns out the jsonwebtoken secret key that i was passing was undefined, if you are using jsonwebtoken, do check it once