node.js - How to handle schema migration in Mongoose? -


i have created schema below

var teamschema = new schema({     name: {         type: string,         default: '',             unique : true       },       location: {         type: string,         unique: true       } }; mongoose.model('team', teamschema); 

in above location attribute unique:true mistake. after removed unique:true , tried add data still throws following error.

errmsg: 'e11000 duplicate key error index: hackathon.teams.$location_1 dup key: { : "bangalore" }' 

how solve , how handle schema if want add more fields ?


Comments