Interface ReactiveFindOperation.TerminatingResults<T>
- All Known Subinterfaces:
ReactiveFindOperation.FindWithCollection<T>, ReactiveFindOperation.FindWithProjection<T>, ReactiveFindOperation.FindWithQuery<T>, ReactiveFindOperation.ReactiveFind<T>, ReactiveFindOperation.TerminatingFind<T>
- Enclosing interface:
ReactiveFindOperation
public static interface ReactiveFindOperation.TerminatingResults<T>
Compose find execution by calling one of the terminating methods.
- Since:
- 5.0
- Author:
- Mark Paluch, Christoph Strobl, Juergen Zimmermann
-
Method Summary
Modifier and TypeMethodDescriptionall()Get all matching elements.first()Get the first or no result.map(QueryResultConverter<? super T, ? extends R> converter) Map the query result to a different type usingQueryResultConverter.one()Get exactly zero or one result.scroll(ScrollPosition scrollPosition) Return a scroll of elements either starting or resuming atScrollPosition.tail()Get all matching elements using atailable cursor.
-
Method Details
-
map
@Contract("_ -> new") <R> ReactiveFindOperation.TerminatingResults<R> map(QueryResultConverter<? super T, ? extends R> converter) Map the query result to a different type usingQueryResultConverter.- Type Parameters:
R-typeof the result.- Parameters:
converter- the converter, must not be null.- Returns:
- new instance of
ReactiveFindOperation.TerminatingResults. - Throws:
IllegalArgumentException- ifconverteris null.- Since:
- 5.0
-
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
-
all
-
scroll
Return a scroll of elements either starting or resuming atScrollPosition.When using
KeysetScrollPosition, make sure to use non-nullablesort propertiesas MongoDB does not support criteria to reconstruct a query result from absent document fields or null values through$gt/$ltoperators.- Parameters:
scrollPosition- the scroll position.- Returns:
- a scroll of the resulting elements.
- Since:
- 4.1
- See Also:
-
tail
Get all matching elements using atailable cursor. The stream will not be completed unless theSubscriptioniscanceled.
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
Fluxemitting converted objects. - Since:
- 2.1
-