Unwinding arrays and document arrays expands them into individual documents so that aggregation can take place of the resulting output. For example, mapping the roles array of an account with 3 roles results in 3 output documents, each containing a roles ObjectId property.
{"$unwind": <property>}
GET /accounts/?pipeline=[{"$project": {"roles": 1}}, {"$unwind": "roles"}]
{
"data": [
{
"_id": "55ff9db67a00a89c14aa31a6",
"object": "account",
"roles": "000000000000000000000004"
},
{
"_id": "55ff9db67a00a89c14aa31a6",
"object": "account",
"roles": "000000000000000000000005"
},
{
"_id": "55ff9db67a00a89c14aa31a6",
"object": "account",
"roles": "000000000000000000000007"
}
],
"hasMore": false,
"object": "list"
}