diff options
-rw-r--r-- | shell/utils.js | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/shell/utils.js b/shell/utils.js index 37f2923a24d..568ebc6a44d 100644 --- a/shell/utils.js +++ b/shell/utils.js @@ -198,23 +198,33 @@ ObjectId.prototype.tojson = function(){ ObjectId.prototype.isObjectId = true; -DBRef.prototype.fetch = function(){ - assert( this.ns , "need a ns" ); - assert( this.id , "need an id" ); +if ( typeof( DBRef ) != "undefined" ){ + DBRef.prototype.fetch = function(){ + assert( this.ns , "need a ns" ); + assert( this.id , "need an id" ); + + return db[ this.ns ].findOne( { _id : this.id } ); + } + + DBRef.prototype.tojson = function(){ + return "{ 'ns' : \"" + this.ns + "\" , 'id' : \"" + this.id + "\" } "; + } - return db[ this.ns ].findOne( { _id : this.id } ); + DBRef.prototype.toString = function(){ + return "DBRef " + this.ns + ":" + this.id; + } } - -DBRef.prototype.tojson = function(){ - return "{ 'ns' : \"" + this.ns + "\" , 'id' : \"" + this.id + "\" } "; +else { + print( "warning: no DBRef" ); } -DBRef.prototype.toString = function(){ - return "DBRef " + this.ns + ":" + this.id; +if ( typeof( BinData ) != "undefined" ){ + BinData.prototype.tojson = function(){ + return "BinData type: " + this.type + " len: " + this.len; + } } - -BinData.prototype.tojson = function(){ - return "BinData type: " + this.type + " len: " + this.len; +else { + print( "warning: no BinData" ); } tojson = function( x ){ |