clear method
Clears component state.
correlationId
(optional) transaction id to trace execution through call chain. Return Future that receives error or null no errors occured.
Implementation
@override
Future clear(String? correlationId) async {
// Return error if collection is not set
if (collectionName == null) {
throw Exception('Collection name is not defined');
}
try {
await collection!.remove(<String, String>{});
} catch (err) {
throw ConnectionException(
correlationId, 'CONNECT_FAILED', 'Connection to mongodb failed')
.withCause(err);
}
}