christkv/node-mongodb-native — Issue #383: DBRef JSON Serialization may be broken
Author: littleroom
Created: 2011-10-26 22:28:32+00:00
State: open

In BSON.js line 1364

DBRef.prototype.toJSON = function() {
return JSON.stringify({
'$ref':this.namespace,
'$id':this.oid,
'$db':this.db == null ? '' : this.db
});
}

Returns a string when serialized using JSON.stringify, for example

"{\"$ref\":\"Object.Person\",\"$id\":\"4ea6f6e76927505e7a000008\",\"$db\":\"contact\"}"

DBRef.prototype.toJSON = function() {
return {
'$ref':this.namespace,
'$id':this.oid,
'$db':this.db == null ? '' : this.db
};
}

returns a proper JSON object, for example

{"$ref":"Object.Person","$id":"4ea6f6e76927505e7a000008","$db":"contact"}