SDK
SDK Javascript v6.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

list #

Returns the list of collections associated to a provided index. The returned list is sorted in alphanumerical order.


list(index, [options]);

ArgumentsTypeDescription
index
string
Index name
options
object
Query options

options #

Additional query options

PropertyType
(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

Resolves #

Resolves to an object containing the following properties:

PropertyTypeDescription
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

Each object in the collections array contains the following properties:

PropertyTypeDescription
name
string
Collection name
type
string
Collection type (realtime or stored)

Usage #

try {
  const options = { from: 1, size: 1 };
  const collectionList = await kuzzle.collection.list('mtp-open-data', options);
  console.log(collectionList);
  /*
    {
      type: 'all',
      collections: [ { name: 'pink-taxi', type: 'stored' } ],
      from: 1,
      size: 1
    }
  */
  console.log('Success');
} catch (error) {
  console.error(error.message);
}