Mongoose / mongoDB drop unique index constraint Mongoose / mongoDB drop unique index constraint mongoose mongoose

Mongoose / mongoDB drop unique index constraint


Yes as stated in the docs:

To modify an existing index, you need to drop and recreate the index with the exception of m TTL indexes.

So your code is correct for the time being. Maybe in the future they add the possibility to change it in place.


Yes that is correct way of dropping. You can either do it from mongo client.

or from node server like this

Model( { {name: 1, location: 1} }, function(err){     if(err){         res.send("error");    }    else{        res.send("success");    }});


If you use a UI tool like RoboMongo, you can drop it from its UI