Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make objectid serialize to something parseable

  • Loading branch information...
commit a96c97161eaff686449560e4f3f5029d91287656 1 parent 7bb37b3
@erh erh authored
Showing with 4 additions and 1 deletion.
  1. +3 −0  jstests/objid1.js
  2. +1 −1  shell/utils.js
View
3  jstests/objid1.js
@@ -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
2  shell/utils.js
@@ -188,7 +188,7 @@ ObjectId.prototype.toString = function(){
}
ObjectId.prototype.tojson = function(){
- return "\"" + this.str + "\"";
+ return " ObjectId( \"" + this.str + "\") ";
}
ObjectId.prototype.isObjectId = true;
Please sign in to comment.
Something went wrong with that request. Please try again.