Imagine you are looping with a string list as output array (say, its name is output[]
). If the loop happens to map nulls (and only nulls) to output[]
, then after the loop ends, output[]
is presented as a document list containing null objects (and not as a string list).
But if the loop mapped even one non-null element, then output[]
is properly represented as a string list. These two outcomes are contrasted below.
This behaviour means subsequent code that uses output[]
becomes unreliable. For example, if subsequent code MAPs output[]
to another string list, and then loops over the second list, that second loop will not kick in if the original output[]
elements were all null.