Skip to content

Commit

Permalink
Implement count for other MR stores
Browse files Browse the repository at this point in the history
  • Loading branch information
mde committed Oct 17, 2013
1 parent 667f0f9 commit c830a30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/adapters/level/index.js
Expand Up @@ -113,6 +113,11 @@ utils.mixin(Adapter.prototype, new (function () {
res = res.slice(0, limit);
}
}

if (query.opts.count) {
res = res.length;
}

callback(null, res);
});
}
Expand Down
5 changes: 5 additions & 0 deletions lib/adapters/riak/index.js
Expand Up @@ -176,6 +176,11 @@ utils.mixin(Adapter.prototype, new (function () {
if (query.opts.limit == 1) {
res = res[0];
}

if (query.opts.count) {
res = res.length;
}

callback(null, res);
}
});
Expand Down

0 comments on commit c830a30

Please sign in to comment.