Permalink
Browse files

make objectid serialize to something parseable

  • Loading branch information...
1 parent 7bb37b3 commit a96c97161eaff686449560e4f3f5029d91287656 @erh erh committed Jul 6, 2009
Showing with 4 additions and 1 deletion.
  1. +3 −0 jstests/objid1.js
  2. +1 −1 shell/utils.js
View
@@ -11,3 +11,6 @@ t.save( { a : a } )
assert( t.findOne().a.isObjectId , "C" );
assert.eq( a.str , t.findOne().a.str , "D" );
+x = { a : new ObjectId() };
+eval( " y = " + tojson( x ) );
+assert.eq( x.a.str , y.a.str , "E" );
View
@@ -188,7 +188,7 @@ ObjectId.prototype.toString = function(){
}
ObjectId.prototype.tojson = function(){
- return "\"" + this.str + "\"";
+ return " ObjectId( \"" + this.str + "\") ";
}
ObjectId.prototype.isObjectId = true;

0 comments on commit a96c971

Please sign in to comment.