Delete from bucket inner json value

Hi,
[
{
“bucket”: {
“abc”: “5435345”,
“def”: “content”,
“__version”: “1.0”,
“map”: {
“1111”: {
“table”: {},
“order”: 1,
“group”: “DEPT”,
“id”: “1111”,
“name”: “Slot 1”,
},
“2222”: {
“table”: {},
“order”: 14,
“group”: “TEAM”,
“id”: “2222”,
“name”: “Slot 2”,
},

How to delet/select json element where “group”= “TEAM”

Thanks

Pinal

SELECT *
FROM default
WHERE  ANY v IN OBJECT_PAIRS(map) SATISFIES v.val.`group` = "TEAM" END;

DELETE FROM  default
WHERE  ANY v IN OBJECT_PAIRS(map) SATISFIES v.val.`group` = "TEAM" END;

https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/objectfun.html

Its selecting all group value… :frowning:

If you need specific group only

SELECT v.*
FROM default
UNNEST  OBJECT_PAIRS(map)  AS v
WHERE  v.val.`group` = "TEAM" END;