Skip to content

Commit

Permalink
feat(objectid): add valueOf to ObjectId prototype
Browse files Browse the repository at this point in the history
fix Automattic#7299
fix graphql/graphql-js#1518

this make interop of ObjectId and GraphQL easier
  • Loading branch information
sibelius committed Dec 18, 2018
1 parent 7911895 commit 3a0f0d4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/types/objectid.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ Object.defineProperty(ObjectId.prototype, '_id', {
}
});

ObjectId.prototype.valueOf = function() {
return this.toString();
};

module.exports = ObjectId;

0 comments on commit 3a0f0d4

Please sign in to comment.