deleteByFilterEx method

Future deleteByFilterEx(
  1. String? correlationId,
  2. Map<String, dynamic> filter
)

Deletes data items that match to a given filter.

This method shall be called by a public deleteByFilter method from child class that receives FilterParams and converts them into a filter function.

  • correlationId (optional) transaction id to trace execution through call chain.
  • filter (optional) a filter JSON object. Return (optional) Future that receives null for success. Throws error

Implementation

Future deleteByFilterEx(
    String? correlationId, Map<String, dynamic> filter) async {
  var result = await collection?.remove(filter);
  if (result != null && result['ok'] == 1.0) {
    var count = result['n'] ?? 0;
    logger.trace(
        correlationId, 'Deleted %d items from %s', [count, collectionName]);
  }
}