I need to identify the list of array records a.d[] that do not have duplicate in a.p[]. In the nested object below with a.d.prid:"2" is such an record: it has same pid with a.p[pid] and a.d[pid], but has the prid different="2"
Example document:
{
"f": 1,
a: [
{
aid:1,
p: [
{
prid: "1",
pid: {
c: "A",
s: "B",
k: "C"
},
X: 20
}
],
d: [
{
prid: "1",
pid: {
c: "A",
s: "B",
k: "C"
}
},
{
prid: "2",
pid: {
c: "A",
s: "B",
k: "C"
}
}
]
}
]
}
I need a list with all such a.d records that have pid for same document in a.d[] and a.p[] , but have different prid
Expected output:
{ "f":1 , "aid": 1 , "prid": 2 }
Later I need to delete those nested objects as they are considered "corrupted", but need to get the list first.