From d11293dc94aca00d5a3e7fe6d50ecd63e9236e31 Mon Sep 17 00:00:00 2001 From: Anatoliy Chakkaev Date: Thu, 16 Aug 2012 14:21:46 +0400 Subject: [PATCH] Provide additional info about collection --- lib/abstract-class.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/abstract-class.js b/lib/abstract-class.js index b0cf1655..aa958c5b 100644 --- a/lib/abstract-class.js +++ b/lib/abstract-class.js @@ -336,7 +336,7 @@ AbstractClass.all = function all(params, cb) { collection = data.map(function (d) { var obj = null; // do not create different instances for the same object - var cached = getCached(constr, d.id); + var cached = d && getCached(constr, d.id); if (cached) { obj = cached; // keep dirty attributes untouthed (remove from dataset) @@ -350,6 +350,9 @@ AbstractClass.all = function all(params, cb) { } return obj; }); + if (data && data.countBeforeLimit) { + collection.countBeforeLimit = data.countBeforeLimit; + } cb(err, collection); } });