Interface ExecutableFindOperation.DistinctWithProjection
- All Known Subinterfaces:
ExecutableFindOperation.DistinctWithQuery<T>, ExecutableFindOperation.TerminatingDistinct<T>
- Enclosing interface:
ExecutableFindOperation
public static interface ExecutableFindOperation.DistinctWithProjection
Result type override. Optional.
- Since:
- 2.1
- Author:
- Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptionDefine the target type the result should be mapped to.
-
Method Details
-
as
Define the target type the result should be mapped to.
Skip this step if you are anyway fine with the default conversion.Object(the default)- Result is mapped according to the
BsonTypeconverting eg.BsonStringinto plainString,BsonInt64toLong, etc. always picking the most concrete type with respect to the domain types property.
AnyBsonType.DOCUMENTis run through theEntityReaderto obtain the domain type.
UsingObjectalso works for non strictly typed fields. Eg. a mixture different types like fields usingStringin oneDocumentwhileLongin another. - Any Simple type like
StringorLong. - The result is mapped directly by the MongoDB Java driver and the
Codecsin place. This works only for results where all documents considered for the operation use the very same type for the field. - Any Domain type
- Domain types can only be mapped if the if the result of the actual
distinct()operation returnsBsonType.DOCUMENT. BsonValue- Using
BsonValueallows retrieval of the raw driver specific format, which returns eg.BsonString.
- Type Parameters:
R- result type.- Parameters:
resultType- must not be null.- Returns:
- new instance of
ExecutableFindOperation.TerminatingDistinct. - Throws:
IllegalArgumentException- if resultType is null.
-