i have 2 types of documents which store user menu info. One is the menu items which holds the info of all menu items in system like links etc. then i have a doc user menu mobile which stores an array of docs with menus for a given user. So when i want to get all menu items i query the menu mobile doc for user and join based on menu key.
the query looks something like this
SELECT mi.menu_item,
mi.position,
mi.visable,
(
SELECT m.menu_description,
m.menu_text,
m.parent_id,
m.menu_helpmsg,
m.menu_icon_href,
m.sort_position,
m.level
FROM Contacts m USE KEYS mi.menu_item)[0]
FROM Contacts c
UNNEST menu_items mi
WHERE c._type = 'user_menu_mobile'
AND c.user_id = '8D6D24A5-D669-45DC-99AC-F257B
i get what i am looking for but the issue is it is not in the format i want…
Current Data returned is like this
[ { "$1": { "level": 0, "menu_description": "This is level 1 Item 2", "menu_helpmsg": "help 1 -1 ", "menu_icon_href": "http://myimage.jpg", "menu_text": "Level 1 Item 2", "parent_id": "", "sort_position": 2 } , "menu_item": "menu::162ed5ed-7992-4698-9ae1-03fb2be6311e", "position": 0, "visable": true } ]
but i would like it in the following format…
[ {
“level”: 0,
“menu_description”: “This is level 1 Item 2”,
“menu_helpmsg”: "help 1 -1 ",
“menu_icon_href”: “http://myimage.jpg”,
“menu_text”: “Level 1 Item 2”,
“parent_id”: “”,
“sort_position”: 2
“menu_item”: “menu::162ed5ed-7992-4698-9ae1-03fb2be6311e”,
“position”: 0,
“visable”: true
}]
So what do i need to change in my query to get rid of the $1 in subquery