Skip to content

Instantly share code, notes, and snippets.

View RavenZZ's full-sized avatar
🎯
Focusing

Raven RavenZZ

🎯
Focusing
View GitHub Profile
@RavenZZ
RavenZZ / DropAllIndexes.js
Last active July 6, 2016 02:58
Drop All Mongodb Indexes
use taskcenter
var collections = db.getCollectionNames()
collections.forEach((tableName)=>{
if(tableName !=="system.profile"){
print(`db.${tableName}.dropIndexes()`);
}
});
@RavenZZ
RavenZZ / gen.js
Last active July 17, 2017 04:44
生成Mongodb索引建立脚本
var db = connect(url);
var dbName = db.getName();
print(`Database: ${dbName}`);
var collections = db.getCollectionNames()
collections.forEach((table)=>{
var commands = [];
var indexes = db[table].getIndexes();
@RavenZZ
RavenZZ / gen.js
Last active March 3, 2017 06:57
根据Mongodb已有索引生成 建立索引脚本
var db = connect(url);
var collections = db.getCollectionNames();
collections.forEach((table)=>{
var commands = [];
var indexes = db[table].getIndexes();
if(indexes.length>0){