find<T> method

  1. @override
Future<T?> find<T>(
  1. dynamic key, [
  2. Type? type
])
override

Finds an entity of the specified type by primary key.

Implementation

@override
Future<T?> find<T>(key, [Type? type]) => _autoRecover(() async {
      var collection = await _collectionFor<T>(type);
      var document = await collection.findOne(where.eq('_id', _toId(key)));
      return document != null ? _toEntity<T>(document, type) : null;
    });