运维网's Archiver
论坛
›
Mongodb
› 批量删除colletion 【MongoDB shell】
???紵
发表于 2015-7-10 09:25:05
批量删除colletion 【MongoDB shell】
use auction
var colls = db.getCollectionNames();
for(var i = 0; i < colls.length; i++){
if(/user_apps_grab_gid_*$/.test(colls)){
print(colls);
//db.auction.drop(colls);
db.runCommand({"drop" : colls});
}
}
页:
[1]
查看完整版本:
批量删除colletion 【MongoDB shell】