第五章 MongoDb索引优化 5.6

7.删除索引
a.删除某个表中的所有索引
To delete all indexes on the specified collection:
命令行: db.collection.dropIndexes();
java: coll.dropIndex("rsc");
b.删除某个表中的单一索引
To delete a single index:
db.schedule.dropIndex({rsc:1});
> db.runCommand(db.schedule.dropIndex({rsc:1}));
{
        "errmsg" : "no such cmd",
        "bad cmd" : {
                "nIndexesWas" : 2,
                "ok" : 1
        },
        "ok" : 0
}
延伸阅读:
http://www.mongodb.org/display/DOCS/Indexes#Indexes-DocumentsasKeys
http://www.mongodb.org/display/DOCS/min+and+max+Query+Specifiers
http://www.mongodb.org/display/DOCS/Advanced+Queries

你可能感兴趣的:(mongodb,索引,职场,休闲)