remove method
Implementation
Future<DbRemoveResponse> remove() async {
if (_queryOptions!.offset != null ||
_queryOptions!.limit != null ||
_queryOptions!.projection != null) {
return DbRemoveResponse(
code: CloudBaseExceptionCode.INVALID_PARAM,
message:
'`offset`, `limit` and `projection` are not supported in remove() operation',
);
}
if (_fieldOrders!.length > 0) {
return DbRemoveResponse(
code: CloudBaseExceptionCode.INVALID_PARAM,
message: '`orderBy` is not supported in remove() operation',
);
}
Map<String, dynamic> params = {'query': this._fieldFilters, 'multi': true};
CloudBaseResponse res = await _queryRequest(
'database.deleteDocument',
params,
);
if (res.code != null) {
return DbRemoveResponse(
code: res.code,
message: res.message,
requestId: res.requestId,
);
}
return DbRemoveResponse(
requestId: res.requestId,
deleted: res.data['deleted'],
);
}