Hi, I am struggling with a query.
My doc looks like this:
{
"RteDocId": "Route::1001_027",
"TrdGtinEo08Val": null,
"$MdfdTmstmp": "2021-10-07T11:27:08.602Z",
"Id": "RAG::1001_0017082876805_027",
"$DocVrsn": "1.0",
"$Type": "RAG",
"MtrlUomIdList": [
{
"MtrlId": "08052200",
"CasePckQty": 1,
"CasePckTyp": "REG",
"MtrlUomId": "08052200"
},
{
"MtrlId": "08052200",
"CasePckQty": 12,
"CasePckTyp": "REG",
"MtrlUomId": "08052201"
}
]
}
There are about 20 million of these docs on the server.
What I need is CasePckTyp for all DISTINCT MtrlId across all docs. I am trying to avoid doing an unnest on MtrlUomIdList as that section is quite large (i am showing only 4 fields in it in my example here).
What I was thinking is to create an object or array with just MtrlId and CasePckTyp and then find distinct MtrlId within that array. Struggling to write that query though… Any pointers on how to go about doing this? Thanks