Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed; debug output for Dates/ObjectId properties
closes #1129
  • Loading branch information
aheckmann committed Oct 1, 2012
1 parent 3e653e3 commit 146ec9d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/drivers/node-mongodb-native/collection.js
Expand Up @@ -169,11 +169,15 @@ function format (obj, sub) {
} else if ('Object' === x[key].constructor.name) {
x[key] = format(x[key], true);
} else if ('ObjectID' === x[key].constructor.name) {
var representation = 'ObjectId("' + x[key].toHexString() + '")';
x[key] = { inspect: function() { return representation; } };
;(function(x){
var representation = 'ObjectId("' + x[key].toHexString() + '")';
x[key] = { inspect: function() { return representation; } };
})(x)
} else if ('Date' === x[key].constructor.name) {
var representation = 'new Date("' + x[key].toUTCString() + '")';
x[key] = { inspect: function() { return representation; } };
;(function(x){
var representation = 'new Date("' + x[key].toUTCString() + '")';
x[key] = { inspect: function() { return representation; } };
})(x)
} else if (Array.isArray(x[key])) {
x[key] = x[key].map(function (o) {
return format(o, true)
Expand Down

0 comments on commit 146ec9d

Please sign in to comment.