From c9d7a0a57d439cba5f403c854284ade35cbbf7be Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Tue, 3 Dec 2013 03:46:38 +0200 Subject: [PATCH] Fixed rename handling in Instance (missed because of previous typo) --- lib/Instance.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Instance.js b/lib/Instance.js index 3cb525a..7410a4c 100644 --- a/lib/Instance.js +++ b/lib/Instance.js @@ -54,10 +54,18 @@ function Instance(collection, doc, options, isNew) { }); var schema = {}; + var renamed = []; for (k in doc) { - schema[k] = false; + if(options.rename[k]) { + schema[k] = options.schema[options.rename[k]]; + renamed.push(options.rename[k]); + } + else + schema[k] = false; } + for (k in options.schema) { + if(renamed.indexOf(k) != -1) continue; schema[k] = options.schema[k]; }