$toString (aggregation)
On this page
Definition
-
$toString
-
Converts a value to a string. If the value cannot be converted to a string,
$toString
errors. If the value is null or missing,$toString
returns null.$toString
has the following syntax:{ $toString: <expression> } The
$toString
takes any valid expression .The
$toString
is a shorthand for the following$convert
expression:{ $convert: { input: <expression>, to: "string" } }
Behavior
The following table lists the input types that can be converted to a