In brief
The transformation and removal of one nested level occur together.
Useful to know
flatMap() performs a function for each element and flattens the resulting result by one level. For example, [1, 2].flatMap(x => [x, x * 10]) gives [1, 10, 2, 20]. [1]
The feature can return an empty record array that needs to be dropped, or several expansion items. This is convenient when converting rows to individual positions. Do not expect recursive removal of any nesting: an additional array inside the returned list remains on the next level.
Sources
For further detail and to check the information: