insertAll<T> method

  1. @override
Future insertAll<T>(
  1. Iterable<T> entities
)
override

Inserts all specified entities of the same type in this Box.

Implementation

@override
Future insertAll<T>(Iterable<T> entities) => _autoRecover(() async {
      var entitySupport = registry.lookup<T>();
      var collection = await _collectionFor(T);
      var documents = entities
          .map((entity) => _wrapKey(
              entitySupport.serialize(entity), entitySupport.keyFields))
          .toList();
      await collection.insertAll(documents,
          writeConcern: WriteConcern.acknowledged);
    });