From e8ef71c43176fa65289443cc4076ea1abf4d7236 Mon Sep 17 00:00:00 2001 From: Anatoliy Chakkaev Date: Mon, 24 Dec 2012 00:31:32 +0400 Subject: [PATCH] Only update id if it does not present in resulting dataset --- lib/abstract-class.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/abstract-class.js b/lib/abstract-class.js index ba8c9545..453794b7 100644 --- a/lib/abstract-class.js +++ b/lib/abstract-class.js @@ -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); }