On this page本页内容
$concat¶Concatenates strings and returns the concatenated string.连接字符串并返回连接的字符串。
$concat has the following syntax:语法如下所示:
The arguments can be any valid expression as long as they resolve to strings. 参数可以是任何有效的表达式,只要它们解析为字符串。For more information on expressions, see Expressions.有关表达式的详细信息,请参阅表达式。
If the argument resolves to a value of 如果参数解析为null or refers to a field that is missing, $concat returns null.null值或引用缺少的字段,$concat返回null。
Consider a 考虑以下文件的inventory collection with the following documents:inventory集合:
The following operation uses the 下面的操作使用$concat operator to concatenate the item field and the description field with a ” - ” delimiter.$concat运算符将item字段和description字段用“-”分隔符连接起来。
The operation returns the following results:操作返回以下结果: