From cb80f82ccb303a8b92eed132c93b00c38882545d Mon Sep 17 00:00:00 2001 From: Aschen Date: Mon, 6 Apr 2020 14:21:13 +0200 Subject: [PATCH 1/3] Remove pagination from collection list --- src/controllers/collection.js | 3 +-- test/controllers/collection.test.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/controllers/collection.js b/src/controllers/collection.js index 1efe54d28..38fea247c 100644 --- a/src/controllers/collection.js +++ b/src/controllers/collection.js @@ -72,8 +72,7 @@ class CollectionController extends BaseController { const request = { index, action: 'list', - from: options.from, - size: options.size + size: 42000 }; delete options.from; delete options.size; diff --git a/test/controllers/collection.test.js b/test/controllers/collection.test.js index 0d810c397..d70e0278b 100644 --- a/test/controllers/collection.test.js +++ b/test/controllers/collection.test.js @@ -220,8 +220,7 @@ describe('Collection Controller', () => { controller: 'collection', action: 'list', index: 'index', - from: undefined, - size: undefined + size: 42000 }, options); should(res).match({ From 1e8d0891b7f118eb2dc301df62850542018e21bd Mon Sep 17 00:00:00 2001 From: Aschen Date: Mon, 6 Apr 2020 18:59:45 +0200 Subject: [PATCH 2/3] Default size to 0 --- src/controllers/collection.js | 2 +- test/controllers/collection.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/collection.js b/src/controllers/collection.js index 38fea247c..59e3569d9 100644 --- a/src/controllers/collection.js +++ b/src/controllers/collection.js @@ -72,7 +72,7 @@ class CollectionController extends BaseController { const request = { index, action: 'list', - size: 42000 + size: 0 }; delete options.from; delete options.size; diff --git a/test/controllers/collection.test.js b/test/controllers/collection.test.js index d70e0278b..3922fbd52 100644 --- a/test/controllers/collection.test.js +++ b/test/controllers/collection.test.js @@ -220,7 +220,7 @@ describe('Collection Controller', () => { controller: 'collection', action: 'list', index: 'index', - size: 42000 + size: 0 }, options); should(res).match({ From cc7822a9329fc450f52c69361fc73708eb4435fe Mon Sep 17 00:00:00 2001 From: Aschen Date: Mon, 6 Apr 2020 19:01:48 +0200 Subject: [PATCH 3/3] Default size to 0 --- doc/7/controllers/collection/list/index.md | 16 ++++++++-------- src/controllers/collection.js | 3 ++- test/controllers/collection.test.js | 3 ++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/doc/7/controllers/collection/list/index.md b/doc/7/controllers/collection/list/index.md index c6b5f6d55..753557a25 100644 --- a/doc/7/controllers/collection/list/index.md +++ b/doc/7/controllers/collection/list/index.md @@ -19,7 +19,7 @@ list(index, [options]);
| Arguments | Type | Description | -| --------- | ----------------- | ------------- | +|-----------|-------------------|---------------| | `index` |
string
| Index name | | `options` |
object
| Query options | @@ -28,26 +28,26 @@ list(index, [options]); Additional query options | Property | Type
(default) | Description | -| ---------- | ------------------------------- | ---------------------------------------------------------------------------- | +|------------|---------------------------------|------------------------------------------------------------------------------| | `queuable` |
boolean

(`true`) | If true, queues the request during downtime, until connected to Kuzzle again | -| `from` |
number

(`0`) | Offset of the first result | -| `size` |
number

(`10`) | Maximum number of returned results | +| `from` |
number

(`0`) | Offset of the first result | +| `size` |
number

(`10`) | Maximum number of returned results | ## Resolves Resolves to an object containing the following properties: | Property | Type | Description | -| ------------- | ------------------- | ------------------------------------------------------------------ | +|---------------|---------------------|--------------------------------------------------------------------| | `type` |
string
| Types of returned collections
(`all`, `realtime` or `stored`) | | `collections` |
object[]
| List of collections | -| `from` |
number
| Offset of the first result | -| `size` |
number
| Maximum number of returned results | +| `from` |
number
| Offset of the first result | +| `size` |
number
| Maximum number of returned results | Each object in the `collections` array contains the following properties: | Property | Type | Description | -| -------- | ----------------- | ---------------------------------------- | +|----------|-------------------|------------------------------------------| | `name` |
string
| Collection name | | `type` |
string
| Collection type (`realtime` or `stored`) | diff --git a/src/controllers/collection.js b/src/controllers/collection.js index 59e3569d9..fb4f2e418 100644 --- a/src/controllers/collection.js +++ b/src/controllers/collection.js @@ -72,7 +72,8 @@ class CollectionController extends BaseController { const request = { index, action: 'list', - size: 0 + size: options.size || 0, + from: options.from }; delete options.from; delete options.size; diff --git a/test/controllers/collection.test.js b/test/controllers/collection.test.js index 3922fbd52..5a7f8a781 100644 --- a/test/controllers/collection.test.js +++ b/test/controllers/collection.test.js @@ -220,7 +220,8 @@ describe('Collection Controller', () => { controller: 'collection', action: 'list', index: 'index', - size: 0 + size: 0, + from: undefined }, options); should(res).match({