listCollections

// Using callbacks (NodeJS or Web Browser)
kuzzle.listCollections('index', {type: 'stored', from: 0, size: 42}, function (err, collections) {
  // ...
});

// Using promises (NodeJS only)
kuzzle
  .listCollectionsPromise('index', {type: 'stored'})
  .then(collections => {
    // ...
  });
kuzzle.listCollections("index", new ResponseListener<JSONObject[]>() {
  @Override
  public void onSuccess(JSONObject[] collections) {
    // ...
  }

  @Override
  public void onError(JSONObject error) {
    // Handle error
  }
});
<?php
use \Kuzzle\Kuzzle;

$kuzzle = new Kuzzle('localhost');
$collections = $kuzzle->listCollections('index', [
  'type' => 'stored',
  'from' => 0,
  'size' => 42
]);

Callback response:

[
  {"name": "realtime_1", "type": "realtime"},
  {"name": "realtime_2", "type": "realtime"},
  {"name": "realtime_...", "type": "realtime"},
  {"name": "realtime_n", "type": "realtime"},
  {"name": "stored_1", "type": "stored"},
  {"name": "stored_2", "type": "stored"},
  {"name": "stored_...", "type": "stored"},
  {"name": "stored_n", "type": "stored"}
]

Retrieves the list of known data collections contained in a specified index.


listCollections([index], [options], callback)

ArgumentsTypeDescription
indexstringIndex containing the collections to be listed
optionsJSON ObjectOptional parameters
callbackfunctionCallback handling the response

Options

OptionTypeDescriptionDefault
queuablebooleanMark this request as (not) queuabletrue
fromintegerDetermines the starting point of the pagination. By default, start at the beggining0
sizeintegerDetermines the size of the returned result set. By default, no limit is appliedundefined
typestringGet either stored collections or realtime ones. By default, list all collectionsall

If no index argument is provided, the defaultIndex property is used. If no default index is found, this method throws an error.


Callback response

Resolves to an array of JSON objects containing the list of stored and/or realtime collections on the provided index.