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 AggregationOperationContext
Deprecated, for removal: This API element is subject to removal in a future version.default AggregationOperationContext
expose
(ExposedFields fields) Create a nestedAggregationOperationContext
from this context that exposesfields
.default org.bson.codecs.configuration.CodecRegistry
Get the underlyingCodecRegistry
used by the MongoDB Java driver.default Fields
Returns theFields
exposed by the type.default org.bson.Document
getMappedObject
(org.bson.Document document) Returns the mappedDocument
, potentially converting the source considering mapping metadata etc.org.bson.Document
getMappedObject
(org.bson.Document document, Class<?> type) Returns the mappedDocument
, potentially converting the source considering mapping metadata for the given type.getReference
(String name) Returns theExposedFields.FieldReference
for the field with the given name.getReference
(Field field) Returns aExposedFields.FieldReference
for the given field.default AggregationOperationContext
inheritAndExpose
(ExposedFields fields) Create a nestedAggregationOperationContext
from this context that inherits exposed fields from this context and exposesfields
.Methods inherited from interface org.springframework.data.mongodb.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.FieldReference
for the given field.- Parameters:
field
- must not be null.- Returns:
- the
ExposedFields.FieldReference
for the givenField
. - Throws:
IllegalArgumentException
- if the context does not expose a field with the given name
-
getReference
Returns theExposedFields.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
Returns theFields
exposed by the type. May be a class or an interface. The default implementation usesproperty descriptors
discover fields from aClass
.- Parameters:
type
- must not be null.- Returns:
- never null.
- Since:
- 2.2
- See Also:
-
expose
Create a nestedAggregationOperationContext
from this context that exposesfields
.Implementations of
AggregationOperationContext
retain theirFieldLookupPolicy
. If no policy is specified, then lookup defaults toFieldLookupPolicy.strict()
.- Parameters:
fields
- the fields to expose, must not be null.- Returns:
- the new
AggregationOperationContext
exposingfields
. - Since:
- 4.3.1
-
inheritAndExpose
Create a nestedAggregationOperationContext
from this context that inherits exposed fields from this context and exposesfields
.Implementations of
AggregationOperationContext
retain theirFieldLookupPolicy
. If no policy is specified, then lookup defaults toFieldLookupPolicy.strict()
.- Parameters:
fields
- the fields to expose, must not be null.- Returns:
- the new
AggregationOperationContext
exposingfields
. - 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,FieldLookupPolicy
should be specified explicitly when creating the AggregationOperationContext.This toggle allows thecontext
to use any given field name without checking for its existence. Typically, theAggregationOperationContext
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 underlyingCodecRegistry
used by the MongoDB Java driver.- Specified by:
getCodecRegistry
in interfaceCodecRegistryProvider
- Returns:
- never null.
-
FieldLookupPolicy
should be specified explicitly when creating the AggregationOperationContext.