Skip to content

Commit

Permalink
Merge pull request #356 from miccarr/master
Browse files Browse the repository at this point in the history
Don't stringify IDs when not bson ObjectID
  • Loading branch information
particlebanana committed Jan 25, 2016
2 parents 82e0391 + ab35d5d commit 0656ff3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ exports.object.hasOwnProperty = function(obj, prop) {
exports._rewriteIds = function(model, schema) {
if (hop.call(model, '_id')) {
// change id to string only if it's necessary
if (typeof model._id === 'object')
if (typeof model._id === 'object' && model._id._bsontype)
model.id = model._id.toString();
else
model.id = model._id;
Expand Down

0 comments on commit 0656ff3

Please sign in to comment.