Hi,
I am having document like below, need to do remove
Need to remove { “id”: “1234”,“responseQual3Url”: “aa” } from document,
I have written like this :
UPDATE default
AS assessment USE KEYS "test"
SET
t.questions = ARRAY_REMOVE(t.questions,EVERY q WITHIN assessment.versions SATISFIES q.id = “1234” END)
FOR t WITHIN assessment.versions when t.id = “TAB-9e56258e-c468-4ca7-aac3-cd74d5ed1952” END
;
But unable to remove
Document is like below :
============================
{
“assessmentName”: “sample_assessment”,
“objectType”: “assessment”,
“versions”: [
{
“createdBy”: “admin”,
“createdOn”: “24-04-2017 15:09:59+0530”,
“generalDescription”: “Just sample assesment”,
“lastUpdated”: “26-04-2017 19:59:21+0530”,
“lastUpdatedBy”: “admin”,
“released”: false,
“tabs”: [
{
“generalDescription”: “tab 1”,
“id”: “TAB-9e56258e-c468-4ca7-aac3-cd74d5ed1952”,
“index”: “0”,
“name”: “Tab1”,
“questions”: [
{
“id”: “QSTN-76dc0adc-259b-415f-b593-120c3a5f3f8b”,
“index”: “0”,
“questionTitle”: “Sample Question”,
“responseQual1Desc”: “bad”,
“responseQual1Url”: null,
“responseQual2Desc”: “poor”,
“responseQual2Url”: null,
“responseQual3Desc”: “avg”,
“responseQual3Url”: null,
“responseQual4Desc”: “good”,
“responseQual4Url”: null,
“responseQual5Desc”: “exc”,
“responseQual5Url”: null,
“responseQualNADesc”: “N/A”
},
{
“id”: “QSTN-93655ae4-646d-471b-b6c9-c7330ae6f651”,
“index”: “1”,
“questionTitle”: “sample2”,
“responseQual1Desc”: “1”,
“responseQual1Url”: null,
“responseQual2Desc”: “2”,
“responseQual2Url”: null,
“responseQual3Desc”: “3”,
“responseQual3Url”: null,
“responseQual4Desc”: “4”,
“responseQual4Url”: null,
“responseQual5Desc”: “5”,
“responseQual5Url”: null,
“responseQualNADesc”: “na”
},
{
“id”: “1234”,
“responseQual3Url”: “aa”
}
]
},
{
“generalDescription”: “Tab 2”,
“id”: “TAB-1a997a9e-5cc5-40f9-8b98-dcbf677af69e”,
“index”: “1”,
“name”: “tab2”,
“questions”: []
},
{
“generalDescription”: “tab 3”,
“id”: “TAB-90e5c17d-d315-4e38-b7ac-8e93736a2b71”,
“index”: “2”,
“name”: “tab3”,
“questions”: [
{
“responseQual3Url”: “aa”
}
]
}
],
“version”: 1
}
]
}
Need help on this ASAP.
Thanks