DB/MongoDB

mongo - drop all indexes

linuxism 2015. 4. 7. 22:46


* Drop all indexes 

> db.collection.dropIndexes();

{

"nIndexesWas" : 2,

"msg" : "non-_id indexes dropped for collection",

"ok" : 1

}


> db.collection.getIndexes()
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"name" : "_id_",
"ns" : "db.collection"
}
]