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 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 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 or 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 ExecutableFindOperation.TerminatingDistinct.
      Throws:
      IllegalArgumentException - if resultType is null.