Hello, assume i have this document:
[
{
"code": "007",
"elements": [
{
"a": "status",
"b": 864,
"c": "good",
"d": "election",
"e": "google",
"f": "Trump[1].Status"
},
{
"a": "function",
"b": 876,
"c": "president",
"d": "election",
"e": "twitter",
"f": "Trump[1].mandat[0]"
},
{
"a": "link",
"b": 246,
"c": "white-house",
"d": "election",
"e": "wordpress",
"f": "Trump[1].link"
},
{
"a": "status",
"b": 963,
"c": "bad",
"d": "election",
"e": "twitter",
"f": "Biden[1].Status"
},
{
"a": "function",
"b": 753,
"c": "politician",
"d": "election",
"e": "snapchat",
"f": "Biden[1].mandat[0]"
},
{
"a": "link",
"b": 159,
"c": "black-house",
"d": "election",
"e": "tiktok",
"f": "Biden[1].link"
},
{
"a": "status",
"b": 456,
"c": "gentle",
"d": "election",
"e": "facebook",
"f": "Trump[2].Status"
},
{
"a": "function",
"b": 852,
"c": "boss",
"d": "election",
"e": "twitter",
"f": "Trump[2].mandat[0]"
},
{
"a": "function",
"b": 888,
"c": "father",
"d": "election",
"e": "facebook",
"f": "Trump[2].mandat[1]"
},
{
"a": "link",
"b": 579,
"c": "trump-tower",
"d": "election",
"e": "twitter",
"f": "Trump[2].link"
}
]
}
}
i am despearatly searching for a query which will give me this:
[
{
"code": "007",
"Trump": ["$1":{
"c1": "good",//from status
"c2": ["president"],//from mandat
"c3": "white-house"//from link
},
"$2":{
"c1": "gentle",//from status
"c2": ["boss","father"],//from mandat
"c3": "trump-tower"//from link
}
],
"Biden": ["$1":{
"c1": "bad",//from status
"c2": ["politician"],//from mandat
"c3": "black-house"//from link
}
]
}
]
Any one can help me? I am stucked there!
Noticed: In the elements array, there are other objects with the “d” field different from “election”, i don’t care about them, i am just concern by d=“election”