From d00922fcc7c5d785a1769645b0cc606036e5cdb1 Mon Sep 17 00:00:00 2001 From: Florian Reifschneider Date: Wed, 23 Oct 2013 10:11:28 -0400 Subject: [PATCH] Fixed casting of discriminatorKey defined Models --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 2c6ee9b..25948e8 100644 --- a/index.js +++ b/index.js @@ -58,7 +58,7 @@ Model.prototype.init = function(doc, query, fn) { // If the discriminatorField contains a model name, we set the documents prototype to that model var type = doc[key]; - var model = this.db.models[type]; + var model = this.db.model(type); if(model) { var newFn = function() { // this is pretty ugly, but we need to run the code below before the callback