$let operator and external variables(MongoDB)

$let Binds variables for use in the specified expression, and returns the result of the expression with Following syntax : { $let: { vars: { < var1 >: < expression >, … }, in: < expression > } } From MongoDB Manual : $let can access variables defined outside its expression block, including system variables. If you modify the values of externally defined variables in the vars block, the new values take effect only in the in expression. »