File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ ObjectID.prototype.generate = function(time) {
171
171
ObjectID . prototype . toString = function ( format ) {
172
172
// Is the id a buffer then use the buffer toString method to return the format
173
173
if ( this . id && this . id . copy ) {
174
- return this . id . toString ( format || 'hex' ) ;
174
+ return this . id . toString ( typeof format === 'string' ? format : 'hex' ) ;
175
175
}
176
176
177
177
// if(this.buffer )
Original file line number Diff line number Diff line change 1
1
var BSON = require ( '../..' ) ;
2
+ var util = require ( 'util' ) ;
2
3
var ObjectId = BSON . ObjectID ;
3
4
4
5
/**
@@ -54,3 +55,23 @@ exports['should correctly create ObjectId from Buffer'] = function(test) {
54
55
test . equal ( true , c ) ;
55
56
test . done ( ) ;
56
57
}
58
+
59
+ /**
60
+ * @ignore
61
+ */
62
+ exports [ 'should correctly allow for node.js inspect to work with ObjectId' ] = function ( test ) {
63
+ var a = 'AAAAAAAAAAAAAAAAAAAAAAAA' ;
64
+ var b = new ObjectId ( a ) ;
65
+ util . inspect ( b ) ;
66
+
67
+ // var c = b.equals(a); // => false
68
+ // test.equal(true, c);
69
+ //
70
+ // var a = 'aaaaaaaaaaaaaaaaaaaaaaaa';
71
+ // var b = new ObjectId(a);
72
+ // var c = b.equals(a); // => true
73
+ // test.equal(true, c);
74
+ // test.equal(a, b.toString());
75
+
76
+ test . done ( ) ;
77
+ }
You can’t perform that action at this time.
0 commit comments