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 TypeMethodDescriptionreactor.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.scroll
(ScrollPosition scrollPosition) Return a scroll of elements either starting or resuming atScrollPosition
.reactor.core.publisher.Flux<T>
tail()
Get all matching elements using atailable 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:
org.springframework.dao.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
Return a scroll of elements either starting or resuming atScrollPosition
.When using
KeysetScrollPosition
, make sure to use non-nullablesort properties
as MongoDB does not support criteria to reconstruct a query result from absent document fields ornull
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 atailable cursor
. The stream will not be completed unless theSubscription
iscanceled
.
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 beDisposable.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 anaggregation execution
even for emptyqueries
which may have an impact on performance, but guarantees shard, session and transaction compliance. In case an inaccurate count satisfies the applications needs useReactiveMongoOperations.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.
-