Javascript 7.x

list

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


Copied to clipboard!
list(index, [options]);

Arguments Type Description
index
string
Index name
options
object
Query options

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
Deprecated since 7.1.4
size
number

(10)
Maximum number of returned results
Deprecated since 7.1.4

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
Deprecated since 7.1.4
size
number
Maximum number of returned results
Deprecated since 7.1.4

Each object in the collections array contains the following properties:

Property Type Description
name
string
Collection name
type
string
Collection type (realtime or stored)

Usage

Copied to clipboard!
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);
}