count method

Future<int> count(
  1. String index,
  2. String collection, {
  3. Map<String, dynamic> query = const {},
})

Counts documents in a data collection.

A query can be provided to alter the count result, otherwise returns the total number of documents in the data collection.

Implementation

Future<int> count(String index, String collection,
    {Map<String, dynamic> query = const {}}) async {
  final response = await kuzzle.query(KuzzleRequest(
    controller: name,
    action: 'count',
    index: index,
    collection: collection,
    body: query,
  ));

  return response.result['count'] as int;
}