org.springframework.data.mongodb.core

Interface ReactiveFindOperation.TerminatingFind<T>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      reactor.core.publisher.Flux<T> all()
      Get all matching elements.
      reactor.core.publisher.Mono<Long> count()
      Get the number of matching elements.
      reactor.core.publisher.Mono<Boolean> exists()
      Check for the presence of matching elements.
      reactor.core.publisher.Mono<T> first()
      Get the first or no result.
      reactor.core.publisher.Mono<T> one()
      Get exactly zero or one result.
      reactor.core.publisher.Flux<T> tail()
      Get all matching elements using a tailable cursor.
    • Method Detail

      • one

        reactor.core.publisher.Mono<T> one()
        Get exactly zero or one result.
        Returns:
        Mono.empty() if no match found. Never null.
        Throws:
        IncorrectResultSizeDataAccessException - if more than one match found.
      • first

        reactor.core.publisher.Mono<T> first()
        Get the first or no result.
        Returns:
        Mono.empty() if no match found. Never null.
      • all

        reactor.core.publisher.Flux<T> all()
        Get all matching elements.
        Returns:
        never null.
      • tail

        reactor.core.publisher.Flux<T> tail()
        Get all matching elements using a tailable cursor. The stream will not be completed unless the Subscription is canceled.

        However, the stream may become dead, or invalid, if either the query returns no match or the cursor returns the document at the "end" of the collection and then the application deletes that document.

        A stream that is no longer in use must be Disposable.dispose() disposed} otherwise the streams will linger and exhaust resources.
        NOTE: Requires a capped collection.

        Returns:
        the Flux emitting converted objects.
        Since:
        2.1
      • count

        reactor.core.publisher.Mono<Long> count()
        Get the number of matching elements.
        Returns:
        Mono emitting total number of matching elements. Never null.
      • exists

        reactor.core.publisher.Mono<Boolean> exists()
        Check for the presence of matching elements.
        Returns:
        Mono emitting true if at least one matching element exists. Never null.