Interface ExecutableFindOperation.DistinctWithProjection

All Known Subinterfaces:
ExecutableFindOperation.DistinctWithQuery<T>, ExecutableFindOperation.TerminatingDistinct<T>
Enclosing interface:

public static interface ExecutableFindOperation.DistinctWithProjection
Result type override. Optional.
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.
      Using BsonValue allows retrieval of the raw driver specific format, which returns eg. BsonString.
      Type Parameters:
      R - result type.
      resultType - must not be null.
      new instance of ExecutableFindOperation.TerminatingDistinct.
      IllegalArgumentException - if resultType is null.