ensureTTLIndex method

Future<Map<String, dynamic>> ensureTTLIndex(
  1. List<String> fields,
  2. [int expireAfter]
)

Implementation

Future<Map<String, dynamic>> ensureTTLIndex(
  List<String> fields, [
  int expireAfter,
]) async {
  expireAfter ??= 0;
  final resp = await _connection.request(
    method: 'POST',
    path: '/_api/index',
    body: {
      'type': 'ttl',
      'expireAfter': expireAfter,
      'fields': fields,
    },
    queries: {'collection': name},
  );
  return resp.body;
}