Class TypeExpressions
java.lang.Object
dev.morphia.aggregation.expressions.TypeExpressions
Defines helper methods for the type expressions
- Since:
- 2.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic ConvertExpression
convert
(Object input, ConvertType to) Converts a value to a specified type.static Expression
Checks if the specified expression resolves to one of the numeric BSON types.static Expression
Converts value to a boolean.static Expression
Converts value to a Decimal128.static Expression
Converts value to a double.static Expression
Converts value to an integer.static Expression
Converts value to a long.static Expression
toObjectId
(Object input) Converts value to an ObjectId.static Expression
Converts value to a string.static Expression
Return the BSON data type of the field.
-
Method Details
-
convert
Converts a value to a specified type.- Parameters:
input
- the value to processto
- an expression giving the target type- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $convert
-
isNumber
Checks if the specified expression resolves to one of the numeric BSON types.- Parameters:
input
- the value to check- Returns:
- the new expression
- Since:
- 2.1
- Since server release
- 4.4
- MongoDB documentation
- Aggregration Expression: $isNumber
-
toBool
Converts value to a boolean.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $toBool
-
toDecimal
Converts value to a Decimal128.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $toDecimal
-
toDouble
Converts value to a double.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $toDouble
-
toInt
Converts value to an integer.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $toInt
-
toLong
Converts value to a long.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $toLong
-
toObjectId
Converts value to an ObjectId.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $toObjectId
-
toString
Converts value to a string.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $toString
-
type
Return the BSON data type of the field.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $type
-