MongoDB Type Conversion Operators
MongoDB Type Conversion Operators are a set of special operators used to convert and manipulate data types in both aggregation and regular queries. This page summarizes the type conversion operators available in MongoDB.
-
$convert
$convert
is an aggregation pipeline operator in MongoDB that converts one data type to another data type. -
$isNumber
$isNumber
is a logical operator in MongoDB used to determine whether a field is of a numeric type. -
$toBool
$toBool
is a built-in operator in MongoDB used to convert a specified value to a Boolean value (true or false). -
$toDate
In MongoDB, the$toDate
operator is used to convert a specified value to a date type. -
$toDecimal
The$toDecimal
operator in MongoDB is used to convert a given value to a decimal number. -
$toDouble
$toDouble
is an aggregation operator in MongoDB used to convert the value of an expression to a double-precision floating-point number. -
$toInt
The MongoDB$toInt
operator converts a value to an integer. -
$toLong
The MongoDB$toLong
operator is an operator used to convert a given value to along
data type. -
$toObjectId
$toObjectId
is a built-in operator in MongoDB used to convert a string to an ObjectId. -
$toString
In MongoDB, the$toString
operator is used to convert any type of data to a string type.