From 0203d527287cdef99601ddaeaf9014ed39797b70 Mon Sep 17 00:00:00 2001 From: Muneeb Samuels Date: Fri, 19 Oct 2012 23:49:01 +0300 Subject: [PATCH] Update lib/adapters/cradle.js fixed an issue where if no filters were passed in, the .all query would throw an exception --- lib/adapters/cradle.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/adapters/cradle.js b/lib/adapters/cradle.js index 6dd13285..aa462db0 100644 --- a/lib/adapters/cradle.js +++ b/lib/adapters/cradle.js @@ -260,9 +260,15 @@ CradleAdapter.prototype.count = function(model, callback, where) { }; CradleAdapter.prototype.models = function(model, filter, callback, func) { + var limit = 99999999; // maybe there is a better way to do this? + var skip = 0; + if (filter != null) { + limit = filter.limit || limit; + skip = filter.skip ||skip; + } + this.client.all( - // maybe there is a better way to do this? - {include_docs:true, limit: filter.limit == null ? 9999999999 : filter.limit, skip: filter.skip == null ? 0 : filter.skip}, + {include_docs:true, limit: limit, skip: skip}, errorHandler(callback, function(res, cb) { var docs = res.map(function(doc) { return idealize(doc);