批量删除colletion 【MongoDB shell】

use auction
var colls = db.getCollectionNames();
for(var i = 0; i < colls.length; i++){
   if(/user_apps_grab_gid_[a-f0-9]*$/.test(colls[i])){
      print(colls[i]);
      //db.auction.drop(colls[i]);
      db.runCommand({"drop" : colls[i]});
   }
}

  

posted @ 2013-03-31 14:35  Arliang  阅读(1174)  评论(0编辑  收藏  举报