summaryrefslogtreecommitdiff
path: root/shell/db.js
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2010-08-09 20:19:00 -0400
committerMathias Stearn <mathias@10gen.com>2010-08-09 20:20:11 -0400
commit790d8851b3c8ff73e2b4e7c3e0038e4eeae28431 (patch)
tree7041ae34f9f979e386088e34423860dc2e22c844 /shell/db.js
parent4162c6ff2acc98258b9d7de9adcd022c754b3ba5 (diff)
downloadmongo-790d8851b3c8ff73e2b4e7c3e0038e4eeae28431.tar.gz
shell tab completion SERVER-1604
Diffstat (limited to 'shell/db.js')
-rw-r--r--shell/db.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/shell/db.js b/shell/db.js
index 829969540f2..652732cb6e7 100644
--- a/shell/db.js
+++ b/shell/db.js
@@ -696,3 +696,13 @@ DB.prototype.listCommands = function(){
DB.prototype.printShardingStatus = function(){
printShardingStatus( this.getSisterDB( "config" ) );
}
+
+DB.autocomplete = function(obj){
+ var colls = obj.getCollectionNames();
+ var ret=[];
+ for (var i=0; i<colls.length; i++){
+ if (colls[i].match(/^[a-zA-Z0-9_.\$]+$/))
+ ret.push(colls[i]);
+ }
+ return ret;
+}