Interface AggregationOperationContext
- All Superinterfaces:
CodecRegistryProvider
- All Known Implementing Classes:
PrefixingDelegatingAggregationOperationContext, RelaxedTypeBasedAggregationOperationContext, TestAggregationContext, TypeBasedAggregationOperationContext
The context for an
AggregationOperation.- Since:
- 1.3
- Author:
- Oliver Gierke, Christoph Strobl, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptiondefault AggregationOperationContextDeprecated, for removal: This API element is subject to removal in a future version.default AggregationOperationContextexpose(ExposedFields fields) Create a nestedAggregationOperationContextfrom this context that exposesfields.default org.bson.codecs.configuration.CodecRegistryGet the underlyingCodecRegistryused by the MongoDB Java driver.default FieldsReturns theFieldsexposed by the type.default org.bson.DocumentgetMappedObject(org.bson.Document document) Returns the mappedDocument, potentially converting the source considering mapping metadata etc.org.bson.DocumentgetMappedObject(org.bson.Document document, @Nullable Class<?> type) Returns the mappedDocument, potentially converting the source considering mapping metadata for the given type.getReference(String name) Returns theExposedFields.FieldReferencefor the field with the given name.getReference(Field field) Returns aExposedFields.FieldReferencefor the given field.default AggregationOperationContextinheritAndExpose(ExposedFields fields) Create a nestedAggregationOperationContextfrom this context that inherits exposed fields from this context and exposesfields.Methods inherited from interface CodecRegistryProvider
getCodecFor, hasCodecFor
-
Method Details
-
getMappedObject
default org.bson.Document getMappedObject(org.bson.Document document) Returns the mappedDocument, potentially converting the source considering mapping metadata etc.- Parameters:
document- will never be null.- Returns:
- must not be null.
-
getMappedObject
Returns the mappedDocument, 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
Returns aExposedFields.FieldReferencefor the given field.- Parameters:
field- must not be null.- Returns:
- the
ExposedFields.FieldReferencefor the givenField. - Throws:
IllegalArgumentException- if the context does not expose a field with the given name
-
getReference
Returns theExposedFields.FieldReferencefor the field with the given name.- Parameters:
name- must not be null or empty.- Returns:
- the
ExposedFields.FieldReferencefor the field with given name. - Throws:
IllegalArgumentException- if the context does not expose a field with the given name
-
getFields
Returns theFieldsexposed by the type. May be a class or an interface. The default implementation usesproperty descriptorsdiscover fields from aClass.- Parameters:
type- must not be null.- Returns:
- never null.
- Since:
- 2.2
- See Also:
-
expose
Create a nestedAggregationOperationContextfrom this context that exposesfields.Implementations of
AggregationOperationContextretain theirFieldLookupPolicy. If no policy is specified, then lookup defaults toFieldLookupPolicy.strict().- Parameters:
fields- the fields to expose, must not be null.- Returns:
- the new
AggregationOperationContextexposingfields. - Since:
- 4.3.1
-
inheritAndExpose
Create a nestedAggregationOperationContextfrom this context that inherits exposed fields from this context and exposesfields.Implementations of
AggregationOperationContextretain theirFieldLookupPolicy. If no policy is specified, then lookup defaults toFieldLookupPolicy.strict().- Parameters:
fields- the fields to expose, must not be null.- Returns:
- the new
AggregationOperationContextexposingfields. - Since:
- 4.3.1
-
continueOnMissingFieldReference
@Deprecated(since="4.3.1", forRemoval=true) default AggregationOperationContext continueOnMissingFieldReference()Deprecated, for removal: This API element is subject to removal in a future version.since 4.3.1,FieldLookupPolicyshould be specified explicitly when creating the AggregationOperationContext.This toggle allows thecontextto use any given field name without checking for its existence. Typically, theAggregationOperationContextfails 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:CodecRegistryProviderGet the underlyingCodecRegistryused by the MongoDB Java driver.- Specified by:
getCodecRegistryin interfaceCodecRegistryProvider- Returns:
- never null.
-
FieldLookupPolicyshould be specified explicitly when creating the AggregationOperationContext.