preserveNullAndEmptyArrays

Controls the behavior of this stage when encountering missing fields, null and empty arrays.

By default, if this function is NOT called, null, missing and empty arrays are ignored: no output documents are created for them.

If this function is called:

  • If the array field is missing or an empty array, a single document is output with the array field missing.

  • If the array field is null, a single document is output with the array field set to null.

External resources