$arrayToObject

The `$arrayToObject` operator converts an array into a single document object. This operator is useful when you need to transform arrays into key-value pairs.

Syntax

{ $arrayToObject: <expression> }

Parameters

<expression>stringrequired

An expression that resolves to an array of two-element arrays or an array of documents containing "k" and "v" fields.