From 4f8384ea94c33129a35fac8f24ae9229aba9d98f Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Wed, 11 Dec 2013 11:18:20 +0200 Subject: [PATCH] Added post-creation plugin hook for Instances --- lib/Instance.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Instance.js b/lib/Instance.js index 5b27d45..95bd90b 100644 --- a/lib/Instance.js +++ b/lib/Instance.js @@ -226,6 +226,10 @@ function Instance(model, doc, isNew) { }, enumerable: false }); + + for(var i = 0; i < model.database.plugins.length; i++) + if(model.database.plugins[i].newInstance) + model.database.plugins[i].newInstance.call(this, model, doc, isNew); } var diffPatch = Instance.diff = function (oldDoc, newDoc, path) {