I have figured out a lookup to find the document and pick some bits out of it e.g.:
SELECT Meta(default).id, `user`.`email`, `user`.`name` FROM default WHERE type="user" AND (ANY token IN sessions SATISFIES token.refresh_token = "2323232323" END);
but cant see how to select the whole object the given refresh_token is located inside?
Could you expand on this a little, it looks interesting but i just keep getting syntax errors when i try all kinds of variations. Is it just me or as dp4 gone a bit backtick required crazy?
SELECT Meta(default).id, name, FIRST s FOR s IN sessions WHEN s.refresh_token = "2323232323" END AS session FROM default WHERE type="user" AND (ANY token IN sessions SATISFIES token.refresh_token = "2323232323" END);
let me know if there is more of an efficient way but this does work. thanks for all the help and ideas…
Thanks for the query . Using this query I am getting data in below format:
{
“lineItemID”: 1,
“note”: [“note1”, “note2” ],
“language”: "Sample Language ",
“type”: “H”,
“metadata”: [ “metadata1”, “metadata2” ]
}
But I need the same in this format like the provided json:
{
“lineItemID”: 1,
“standards”: {
“note”: [“note1”, “note2” ]
},
“language”: "Sample Language ",
“type”: “H”,
“metadata”: [ “metadata1”, “metadata2” ]
}
SELECT b.lineItemID,
b.metadata,
b.language,
b.type,
OBJECT_ADD({},"note",b.standards.note) AS standards
FROM default b
WHERE "note1" IN b.standards.note
Thanks for the query.
But it is not working if more than one values are passed in standards like below.
SELECT b.lineItemID,
b.metadata,
b.language,
b.type,
OBJECT_ADD({},“note”,b.standards.note) AS standards
FROM default b
WHERE [“note1”,“notes2”,…] IN b.standards.note
SELECT b.lineItemID,
b.metadata,
b.language,
b.type,
OBJECT_ADD({},"note",b.standards.note) AS standards
FROM default b
WHERE ANY n IN b.standards.note SATISFIES n IN ["note1","note2","note3"] END
Hi…
I have a new requirement for the above data like below:
{
“lineItemID”: 1,
“standards”: {
“other”: [
{id:“other1”,referenceUrl:""},
{id:“other2”,referenceUrl:""}
]
“note”: [
{id:“note1”,referenceUrl:""},
{id:“note2”,referenceUrl:""},
{id:“note3”,referenceUrl:""}
]
},
“language”: "Sample Language ",
“type”: “H”,
“metadata”: [ “metadata1”, “metadata2” ]
}
Now, need to select “note1”,“note3” from the “standards” in this json. I am using unnest clause to fetch.
Can you please help.
SELECT b.lineItemID,
b.metadata,
b.language,
b.type,
{"note": note} AS standards
FROM default b
LET note = ARRAY v FOR v IN b.standards.note WHEN v.id IN ["note1","note2"] END
WHERE ARRAY_LENGTH(note) > 0;
Now, I want to display the data for lineItemID 5539 , like below where the details of earlyAdoptionTag will show like below:
O/P-
{
“lineItemID”: 5539,
“indent”: 2,
“earlyAdoptionTag”: “asu201509”,
“eAstandards”: {
[
{
“adoptableDate”: “12/01/2016”,
“entityType”: “PBE”,
“requiredDate”: “12/16/2017”
}
]
},
“isDeleted”: false,
“smefinallanguage”: “Balance Sheet”,
“createdDate”: “10/12/2017”,
“createdBy”: “test user4”
}