Skip to content

Instantly share code, notes, and snippets.

@alcaeus
Created January 13, 2016 06:33
Show Gist options
  • Save alcaeus/edee034ed1051ad1267f to your computer and use it in GitHub Desktop.
Save alcaeus/edee034ed1051ad1267f to your computer and use it in GitHub Desktop.
Show all fields in DBRef objects
DBRef.prototype.toString = function () {
var r = ['"$ref": ' + tojson(this.$ref), '"$id": ' + tojson(this.$id)];
var o = this;
for (var p in o) {
if (p !== '$ref' && p !== '$id' && typeof o[p] !== 'function') {
var t = typeof o[p];
r.push('"' + p + '": ' +
(t == 'object' ? 'object: {...}' : '"' + o[p] + '"'));
}
}
return '{' + r.join(', ') + '}';
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment