File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -149,10 +149,17 @@ ObjectID.prototype.generate = function(time) {
149
149
/**
150
150
* Converts the id into a 24 byte hex string for printing
151
151
*
152
+ * @param {String } format The Buffer toString format parameter.
152
153
* @return {String } return the 24 byte hex string representation.
153
154
* @ignore
154
155
*/
155
- ObjectID . prototype . toString = function ( ) {
156
+ ObjectID . prototype . toString = function ( format ) {
157
+ // Is the id a buffer then use the buffer toString method to return the format
158
+ if ( this . id instanceof Buffer ) {
159
+ return this . id . toString ( format || 'hex' ) ;
160
+ }
161
+
162
+ // if(this.buffer )
156
163
return this . toHexString ( ) ;
157
164
} ;
158
165
Original file line number Diff line number Diff line change @@ -52,6 +52,5 @@ exports['should correctly create ObjectId from Buffer'] = function(test) {
52
52
var c = b . equals ( a ) ; // => true
53
53
test . equal ( a , b . toString ( ) ) ;
54
54
test . equal ( true , c ) ;
55
-
56
55
test . done ( ) ;
57
56
}
You can’t perform that action at this time.
0 commit comments