Interface ReactiveFindOperation.TerminatingFind<T>

All Known Subinterfaces:
ReactiveFindOperation.FindWithCollection<T>, ReactiveFindOperation.FindWithProjection<T>, ReactiveFindOperation.FindWithQuery<T>, ReactiveFindOperation.ReactiveFind<T>
Enclosing interface:
ReactiveFindOperation

public static interface ReactiveFindOperation.TerminatingFind<T>
Compose find execution by calling one of the terminating methods.
  • Method Summary

    Modifier and Type
    Method
    Description
    reactor.core.publisher.Flux<T>
    all()
    Get all matching elements.
    reactor.core.publisher.Mono<Long>
    Get the number of matching elements.
    reactor.core.publisher.Mono<Boolean>
    Check for the presence of matching elements.
    reactor.core.publisher.Mono<T>
    Get the first or no result.
    reactor.core.publisher.Mono<T>
    one()
    Get exactly zero or one result.
    reactor.core.publisher.Mono<Window<T>>
    scroll(ScrollPosition scrollPosition)
    Return a scroll of elements either starting or resuming at ScrollPosition.
    reactor.core.publisher.Flux<T>
    Get all matching elements using a tailable cursor.
  • Method Details

    • 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.
    • scroll

      reactor.core.publisher.Mono<Window<T>> scroll(ScrollPosition scrollPosition)
      Return a scroll of elements either starting or resuming at ScrollPosition.

      When using KeysetScrollPosition, make sure to use non-nullable sort properties as MongoDB does not support criteria to reconstruct a query result from absent document fields or null values through $gt/$lt operators.

      Parameters:
      scrollPosition - the scroll position.
      Returns:
      a scroll of the resulting elements.
      Since:
      4.1
      See Also:
    • 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.
      This method uses an aggregation execution even for empty queries which may have an impact on performance, but guarantees shard, session and transaction compliance. In case an inaccurate count satisfies the applications needs use ReactiveMongoOperations.estimatedCount(String) for empty queries instead.
      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.