Unwind

Deconstructs an array type field from the input data and output a document for each element of the array.

When you are working with some specific elements of an array type field, Unwind can make you life easier. It contains two parts:

  1. The field you want to unwind: It must be an array or operators that returns an array.

  2. Whether to include an index: This is optional.

For example you have some data looks like above: The log field contains four elements.

Last updated