Provide additional info about collection

This commit is contained in:
Anatoliy Chakkaev 2012-08-16 14:21:46 +04:00
parent 08ad920a2c
commit d11293dc94
1 changed files with 4 additions and 1 deletions

View File

@ -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);
}
});