How can I Pivot on MongoDB
<p>Given the documents:</p>

<pre><code>{
    "_id" : "8843c0c0-846f-44ae-9b69-a124dd28f4db",
    "purchaseOrderData" : {
        "purchaseOrderId" : "WI9ZF"
    }
}

{
    "_id" : "c3fb80fc-75c0-4259-9d5a-1bc6de1ce7d7",
    "purchaseOrderData" : {
        "purchaseOrderId" : "WJ0DD"
    }
}

{
    "_id" : "2ae496e6-28f9-4baa-b952-2054a505f658",
    "purchaseOrderData" : {
        "purchaseOrderId" : "WI8PP"
    }
}

{
    "_id" : "421ccbed-0824-443f-bf42-3f0049f46c71",
    "purchaseOrderData" : {
        "purchaseOrderId" : "WI9WH"
    }
}

{
    "_id" : "5481b1ef-5f0f-4ba1-8210-d704e9650af4",
    "purchaseOrderData" : {
        "purchaseOrderId" : "WI9ZH"
    }
}

{
    "_id" : "1640a27a-6577-4240-8aaa-4c4b1334fd6d",
    "purchaseOrderData" : {
        "purchaseOrderId" : "WJ0DD"
    }
}

{
    "_id" : "bd95d801-da2d-4556-a223-dcff30b6ab9d",
    "purchaseOrderData" : {}
}

{
    "_id" : "4880f816-41e7-43bc-bed4-e8574aa9c045",
    "purchaseOrderData" : {
        "purchaseOrderId" : "WI9LA"
    }
}

{
    "_id" : "fe651764-aeb4-460e-89fa-474fcec33f19",
    "purchaseOrderData" : {}
}

{
    "_id" : "4d73431c-85dc-479a-8739-b314d6cd9636",
    "purchaseOrderData" : {
        "purchaseOrderId" : "WI9LA"
    }
}
</code></pre>

<p>i want a result like:</p>

<pre><code>{
    "purchaseOrderData.purchaseOrderId":["_id1","_id2"]
}
</code></pre>

<p>ex:</p>

<pre><code>[{
    "WI9ZF":["8843c0c0-846f-44ae-9b69-a124dd28f4db"]
 },{
    "WI9WH":["421ccbed-0824-443f-bf42-3f0049f46c71","5481b1ef-5f0f-4ba1-8210-d704e9650af4"]
 }]
</code></pre>