org.springframework.data.mongodb.core

Interface ReactiveFindOperation.DistinctWithProjection

    • Method Detail

      • as

        <R> ReactiveFindOperation.TerminatingDistinct<R> as(Class<R> resultType)
        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 BsonType converting eg. BsonString into plain String, BsonInt64 to Long, etc. always picking the most concrete type with respect to the domain types property.
        Any BsonType.DOCUMENT is run through the EntityReader to obtain the domain type.
        Using Object also works for non strictly typed fields. Eg. a mixture different types like fields using String in one Document while Long in another.
        Any Simple type like String, Long, ...
        The result is mapped directly by the MongoDB Java driver and the Codecs in 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 returns BsonType.DOCUMENT.
        BsonValue
        Using BsonValue allows 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 ReactiveFindOperation.TerminatingDistinct.
        Throws:
        IllegalArgumentException - if resultType is null.