MongoDB Extract subarrays from documents
<p>How do I pass from this collection of documents</p>

<pre><code>/* 1 */
{
    "F" : [ 
        {
            "n" : "test1",
            "v" : "value1"
        }, 
        {
            "n" : "test2",
            "v" : "value2"
        }
    ],
    "POR" : [ 
        {
            "n" : "1test1",
            "v" : "1value1"
        }, 
        {
            "n" : "1test2",
            "v" : "1value2"
        }, 
        {
            "n" : "1test3",
            "v" : "1value3"
        }
    ]
}

/* 2 */
{
    "F" : [ 
        {
            "n" : "2test1",
            "v" : "2value1"
        }, 
        {
            "n" : "2test2",
            "v" : "2value2"
        }
    ],
    "POR" : [ 
        {
            "n" : "2test1",
            "v" : "2value1"
        }, 
        {
            "n" : "2test2",
            "v" : "2value2"
        }
    ]
}

/* 3 */
{
    "F" : [ 
        {
            "n" : "3test1",
            "v" : "3value1"
        }, 
        {
            "n" : "3test2",
            "v" : "3value2"
        }
    ],
    "POR" : [ 
        {
            "n" : "3test1",
            "v" : "3value1"
        }
    ]
}
</code></pre>

<p>to this:</p>

<pre><code>{
    "ITEMS": [
        { "n": "2test1", "v": "2value1" },
        { "n": "2test2", "v": "2value2" },
        { "n": "1test1", "v": "1value1" },
        { "n": "1test2", "v": "1value2" },
        { "n": "1test3", "v": "1value3" },
        { "n": "3test1", "v": "3value1" }
    ]
}
</code></pre>

<p>I want to extract subarray elements from serveral documents and I can't find the way/method.</p>

<p>First approach tried: </p>

<pre><code>db.test.aggregate( [ { $unwind : "$POR" } ] ).pretty();
</code></pre>