createCollection method

Implementation

Future<CollectionPropertiesResponse> createCollection(
    CollectionCriteria criteria) async {
  final keyOptions = criteria.keyOptions;
  final answer = await _httpPost([
    '_db',
    db,
    '_api',
    'collection'
  ], {
    'name': criteria.name,
    'waitForSync': criteria.waitForSync,
    'type': _typeFromCollectionType(criteria.collectionType),
    if (keyOptions != null) 'keyOptions': keyOptions.toMap()
  });
  final ret = _toCollectionPropertiesResult(answer);
  return ret;
}