Class MongoDbRows<T>

  • Type Parameters:
    T - type of the result, starts as DbRow
    All Implemented Interfaces:
    DbRows<T>

    public final class MongoDbRows<T>
    extends Object
    implements DbRows<T>
    Mongo specific execution result containing result set with multiple rows.
    • Method Detail

      • map

        public <U> DbRows<U> map​(Function<T,​U> mapper)
        Description copied from interface: DbRows
        Map this row result using a mapping function.
        Specified by:
        map in interface DbRows<T>
        Type Parameters:
        U - new type of the row result
        Parameters:
        mapper - mapping function
        Returns:
        row result of the correct type
      • map

        public <U> DbRows<U> map​(Class<U> type)
        Description copied from interface: DbRows
        Map this row result using a configured Mapper that can map current type to the desired type.

        The first mapping for row results of type DbRow will also try to locate appropriate mapper using DbMapperManager.

        Specified by:
        map in interface DbRows<T>
        Type Parameters:
        U - new type of the row result
        Parameters:
        type - class to map values to
        Returns:
        row result of the correct type
      • map

        public <U> DbRows<U> map​(GenericType<U> type)
        Description copied from interface: DbRows
        Map this row result using a configured Mapper that can map current type to the desired type.

        The first mapping for row results of type DbRow will also try to locate appropriate mapper using DbMapperManager.

        Specified by:
        map in interface DbRows<T>
        Type Parameters:
        U - new type of the row result
        Parameters:
        type - generic type to map values to
        Returns:
        row result of the target type
      • publisher

        public Flow.Publisher<T> publisher()
        Description copied from interface: DbRows
        Get this result as a publisher of rows mapped to the correct type.
        Specified by:
        publisher in interface DbRows<T>
        Returns:
        publisher
      • collect

        public CompletionStage<List<T>> collect()
        Description copied from interface: DbRows
        Collect all the results into a list of rows mapped to the correct type.

        This is a dangerous operation, as it collects all results in memory. Use with care.

        Specified by:
        collect in interface DbRows<T>
        Returns:
        future with the list