diff --git a/plugins/mongo/load_databases.js b/plugins/mongo/load_databases.js new file mode 100644 index 00000000..75b79eda --- /dev/null +++ b/plugins/mongo/load_databases.js @@ -0,0 +1,5 @@ +dbs = db.adminCommand( {listDatabases: 1} ).databases; + +for(var i = 0; i < dbs.length; i++) { + print(dbs[i].name); +} diff --git a/plugins/mongo/mongo.plugin.zsh b/plugins/mongo/mongo.plugin.zsh new file mode 100644 index 00000000..7e6c58f0 --- /dev/null +++ b/plugins/mongo/mongo.plugin.zsh @@ -0,0 +1,6 @@ +_mongodbs() { + mypath=$(dirname $0) + compadd $(mongo --quiet $mypath/load_databases.js) +} +compdef _mongodbs mongo +