Skip to content

Commit a984ca8

Browse files
authored
Merge branch 'develop' into feature-451-aggregations
2 parents 92a3145 + fca4c60 commit a984ca8

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kuzzle-sdk",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"description": "Official Javascript SDK for Kuzzle",
55
"author": "The Kuzzle Team <[email protected]>",
66
"repository": {

src/kuzzle.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,8 @@ Kuzzle.prototype.listCollections = function () {
968968
index,
969969
options,
970970
cb,
971-
args = Array.prototype.slice.call(arguments);
971+
args = Array.prototype.slice.call(arguments),
972+
query;
972973

973974
args.forEach(function(arg) {
974975
switch (typeof arg) {
@@ -998,7 +999,17 @@ Kuzzle.prototype.listCollections = function () {
998999
collectionType = options.type;
9991000
}
10001001

1001-
this.query({index: index, controller: 'read', action: 'listCollections'}, {body: {type: collectionType}}, options, function (err, res) {
1002+
query = {body: {type: collectionType}};
1003+
1004+
if (options && options.from) {
1005+
query.body.from = options.from;
1006+
}
1007+
1008+
if (options && options.size) {
1009+
query.body.size = options.size;
1010+
}
1011+
1012+
this.query({index: index, controller: 'read', action: 'listCollections'}, query, options, function (err, res) {
10021013
if (err) {
10031014
return cb(err);
10041015
}

test/kuzzle/methods.test.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,21 @@ describe('Kuzzle methods', function () {
339339
});
340340
});
341341

342-
it('should handle options correctly', function (done) {
342+
it('should handle type option correctly', function (done) {
343343
expectedQuery.body.type = 'foobar';
344344
kuzzle.listCollections('foo', {type: 'foobar'}, () => done());
345345
});
346346

347+
it('should handle from option correctly', function (done) {
348+
expectedQuery.body.from = 'foobar';
349+
kuzzle.listCollections('foo', {from: 'foobar'}, () => done());
350+
});
351+
352+
it('should handle size option correctly', function (done) {
353+
expectedQuery.body.size = 'foobar';
354+
kuzzle.listCollections('foo', {size: 'foobar'}, () => done());
355+
});
356+
347357
it('should use the default index if none is provided', function () {
348358
kuzzle.setDefaultIndex('foo');
349359
kuzzle.listCollections(function () {});

0 commit comments

Comments
 (0)