mongo批量删除js示例
db.system.js.save( { _id: "ddel", value :function (x,y,range,sleeptime) { try{ for (var i = x ; i <= y; i +=range){ print("delete_id: "+ i); db.getCollection('xxx').deleteMany({"_id":{$gte:i,$lte : i+range}}) sleep (sleeptime); }; } catch (e) { print(e); } } } )
db.loadServerScripts()
ddel(79000,80000)