E11000 duplicate key error index in mongodb mongoose

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

Following is my user schema in user.js model -

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


        
25条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 06:21

    It's not a big issue but beginner level developers as like me, we things what kind of error is this and finally we weast huge time for solve it.

    Actually if you delete the db and create the db once again and after try to create the collection then it's will be work properly.

    ➜ mongo
    use dbName;
    db.dropDatabase();
    exit
    

提交回复
热议问题