E11000 duplicate key error index in mongodb mongoose

前端 未结 25 1644
自闭症患者
自闭症患者 2020-11-22 05:49

Following is my user schema in user.js model -

var userSchema = new mongoose.Schema({
    local: {
        name: { type: String },
         


        
25条回答
  •  -上瘾入骨i
    2020-11-22 06:28

    Check collection indexes.

    I had that issue due to outdated indexes in collection for fields, which should be stored by different new path.

    Mongoose adds index, when you specify field as unique.

提交回复
热议问题