ensurePersistentIndex method

Future<Map<String, dynamic>> ensurePersistentIndex(
  1. List<String> fields,
  2. {bool unique = false,
  3. bool sparse = false}
)

Implementation

Future<Map<String, dynamic>> ensurePersistentIndex(
  List<String> fields, {
  bool unique = false,
  bool sparse = false,
}) async {
  final resp = await _connection.request(
    method: 'POST',
    path: '/_api/index',
    body: {
      'type': 'persistent',
      'unique': unique,
      'sparse': sparse,
      'fields': fields,
    },
    queries: {'collection': name},
  );
  return resp.body;
}