close method
Closes component and frees used resources.
correlationId
(optional) transaction id to trace execution through call chain. Return Future that receives error or null no errors occured.
Implementation
@override
Future close(String? correlationId) async {
if (!_opened) {
return null;
}
if (connection == null) {
throw InvalidStateException(
correlationId, 'NOconnection', 'MongoDb connection is missing');
}
if (_localConnection == true) {
await connection!.close(correlationId);
}
_opened = false;
client = null;
collection = null;
}