public static class ConvertOperators.Convert extends Object
AggregationExpression for $convert that converts a value to a specified type. | Modifier and Type | Method and Description |
|---|---|
protected List<Object> |
append(Object value) |
protected Map<String,Object> |
append(String key,
Object value) |
protected Map<String,Object> |
argumentMap()
Get the argument map.
|
protected static List<Field> |
asFields(String... fieldRefs) |
protected boolean |
contains(Object key)
Check if the given key is available.
|
static ConvertOperators.Convert |
convertValue(Object value)
Creates new
ConvertOperators.Convert using the given value for the input attribute. |
static ConvertOperators.Convert |
convertValueOf(AggregationExpression expression)
Creates new
ConvertOperators.Convert using the result of the provided expression as
input value. |
static ConvertOperators.Convert |
convertValueOf(String fieldReference)
Creates new
ConvertOperators.Convert using the value of the provided fieldReference as input
value. |
protected <T> T |
get(int index)
Get the value at a given index.
|
protected <T> T |
get(Object key)
Get the value for a given key.
|
protected String |
getMongoMethod() |
ConvertOperators.Convert |
onErrorReturn(Object value)
Optionally specify the value to return on encountering an error during conversion.
|
ConvertOperators.Convert |
onErrorReturnValueOf(AggregationExpression expression)
Optionally specify the expression to evaluate and return on encountering an error during conversion.
|
ConvertOperators.Convert |
onErrorReturnValueOf(String fieldReference)
Optionally specify the field holding the value to return on encountering an error during conversion.
|
ConvertOperators.Convert |
onNullReturn(Object value)
Optionally specify the value to return when the input is null or missing.
|
ConvertOperators.Convert |
onNullReturnValueOf(AggregationExpression expression)
Optionally specify the expression to evaluate and return when the input is null or missing.
|
ConvertOperators.Convert |
onNullReturnValueOf(String fieldReference)
Optionally specify the field holding the value to return when the input is null or missing.
|
ConvertOperators.Convert |
to(int numericTypeIdentifier)
Specify the conversion target type via its numeric representation.
|
ConvertOperators.Convert |
to(JsonSchemaObject.Type type)
Specify the conversion target type.
|
ConvertOperators.Convert |
to(String stringTypeIdentifier)
Specify the conversion target type via its
String representation. |
org.bson.Document |
toDocument(AggregationOperationContext context)
|
org.bson.Document |
toDocument(Object value,
AggregationOperationContext context) |
ConvertOperators.Convert |
toTypeOf(AggregationExpression expression)
Specify the conversion target type via the value of the given
expression. |
ConvertOperators.Convert |
toTypeOf(String fieldReference)
Specify the conversion target type via the value of the given field.
|
protected List<Object> |
values() |
public static ConvertOperators.Convert convertValue(Object value)
ConvertOperators.Convert using the given value for the input attribute.value - must not be null.ConvertOperators.Convert.public static ConvertOperators.Convert convertValueOf(String fieldReference)
ConvertOperators.Convert using the value of the provided fieldReference as input
value.fieldReference - must not be null.ConvertOperators.Convert.public static ConvertOperators.Convert convertValueOf(AggregationExpression expression)
ConvertOperators.Convert using the result of the provided expression as
input value.expression - must not be null.ConvertOperators.Convert.public ConvertOperators.Convert to(String stringTypeIdentifier)
String representation.
stringTypeIdentifier - must not be null.ConvertOperators.Convert.public ConvertOperators.Convert to(int numericTypeIdentifier)
numericTypeIdentifier - must not be null.ConvertOperators.Convert.public ConvertOperators.Convert to(JsonSchemaObject.Type type)
type - must not be null.ConvertOperators.Convert.public ConvertOperators.Convert toTypeOf(String fieldReference)
fieldReference - must not be null.ConvertOperators.Convert.public ConvertOperators.Convert toTypeOf(AggregationExpression expression)
expression.expression - must not be null.ConvertOperators.Convert.public ConvertOperators.Convert onErrorReturn(Object value)
value - must not be null.ConvertOperators.Convert.public ConvertOperators.Convert onErrorReturnValueOf(String fieldReference)
fieldReference - must not be null.ConvertOperators.Convert.public ConvertOperators.Convert onErrorReturnValueOf(AggregationExpression expression)
expression - must not be null.ConvertOperators.Convert.public ConvertOperators.Convert onNullReturn(Object value)
value - must not be null.ConvertOperators.Convert.public ConvertOperators.Convert onNullReturnValueOf(String fieldReference)
fieldReference - must not be null.ConvertOperators.Convert.public ConvertOperators.Convert onNullReturnValueOf(AggregationExpression expression)
expression - must not be null.ConvertOperators.Convert.protected String getMongoMethod()
public org.bson.Document toDocument(AggregationOperationContext context)
AggregationExpressiontoDocument in interface AggregationExpressionpublic org.bson.Document toDocument(Object value, AggregationOperationContext context)
protected <T> T get(int index)
T - index - protected <T> T get(Object key)
T - key - protected boolean contains(Object key)
key - Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.