Only update id if it does not present in resulting dataset

This commit is contained in:
Anatoliy Chakkaev 2012-12-24 00:31:32 +04:00
parent c08a220dda
commit e8ef71c431
1 changed files with 3 additions and 1 deletions

View File

@ -286,7 +286,9 @@ AbstractClass.find = function find(id, cb) {
this.schema.adapter.find(this.modelName, id, function (err, data) {
var obj = null;
if (data) {
data.id = id;
if (!data.id) {
data.id = id;
}
obj = new this();
obj._initProperties(data, false);
}