Interface AggregationOperationContext

All Superinterfaces:
CodecRegistryProvider
All Known Implementing Classes:
PrefixingDelegatingAggregationOperationContext, RelaxedTypeBasedAggregationOperationContext, TestAggregationContext, TypeBasedAggregationOperationContext

public interface AggregationOperationContext extends CodecRegistryProvider
The context for an AggregationOperation.
Since:
1.3
Author:
Oliver Gierke, Christoph Strobl
  • Method Details

    • getMappedObject

      default org.bson.Document getMappedObject(org.bson.Document document)
      Returns the mapped Document, potentially converting the source considering mapping metadata etc.
      Parameters:
      document - will never be null.
      Returns:
      must not be null.
    • getMappedObject

      org.bson.Document getMappedObject(org.bson.Document document, @Nullable Class<?> type)
      Returns the mapped Document, potentially converting the source considering mapping metadata for the given type.
      Parameters:
      document - will never be null.
      type - can be null.
      Returns:
      must not be null.
      Since:
      2.2
    • getReference

      ExposedFields.FieldReference getReference(Field field)
      Returns a ExposedFields.FieldReference for the given field.
      Parameters:
      field - must not be null.
      Returns:
      the ExposedFields.FieldReference for the given Field.
      Throws:
      IllegalArgumentException - if the context does not expose a field with the given name
    • getReference

      Returns the ExposedFields.FieldReference for the field with the given name.
      Parameters:
      name - must not be null or empty.
      Returns:
      the ExposedFields.FieldReference for the field with given name.
      Throws:
      IllegalArgumentException - if the context does not expose a field with the given name
    • getFields

      default Fields getFields(Class<?> type)
      Returns the Fields exposed by the type. May be a class or an interface. The default implementation uses property descriptors discover fields from a Class.
      Parameters:
      type - must not be null.
      Returns:
      never null.
      Since:
      2.2
      See Also:
      • BeanUtils.getPropertyDescriptor(Class, String)
    • continueOnMissingFieldReference

      default AggregationOperationContext continueOnMissingFieldReference()
      This toggle allows the context to use any given field name without checking for its existence. Typically the AggregationOperationContext fails when referencing unknown fields, those that are not present in one of the previous stages or the input source, throughout the pipeline.
      Returns:
      a more relaxed AggregationOperationContext.
      Since:
      3.0
    • getCodecRegistry

      default org.bson.codecs.configuration.CodecRegistry getCodecRegistry()
      Description copied from interface: CodecRegistryProvider
      Get the underlying CodecRegistry used by the MongoDB Java driver.
      Specified by:
      getCodecRegistry in interface CodecRegistryProvider
      Returns:
      never null.