When you map an input map element to an output map element, and the input map element is contained within (or is) a looping map element, a loop expression for the nearest containing looping output map element is automatically constructed, if it has not been explicitly specified. This output loop expression uses the SimpleLoop function to loop through the input map elements.
This process is repeated, going up to the next containing looping input map element and matching that with the next containing output looping map element until a loop expression is found for an output looping map element. By default, a loop expression is created for the root output map element, as it is assumed that there is exactly one output document for every input document.
In the case where the input side has more containing loops than the output the generated loop expression will include the extra loops as nested loops. Where the input side has fewer containing loops, the generation of the output loop expressions stops when the input loops are exhausted and the remaining containing looping output elements are left without a loop expression which will cause a warning when the map is executed. This warning tells you to specify a loop expression for the output (which could be something like a FixedLoop function).