As Prefix, i have docs which provide more detail about a farm which look like this
{
"_id": "EDA9460D-26F7-4F63-A804-36FB0CB395CB",
"_type": "tract_info",
"name": "Crown Park",
"city": "Laguna Niguel",
"tract_id": [
7340
]
}
my query has a few issues if i use
select
meta().id as DocId,
mailingAddress.address || " " || mailingAddress.city || " " || mailingAddress.state || " " || mailingAddress.zip ||"-" || mailingAddress.zip4 as mailing_address,
(select name from Contacts as d where _type ="tract_info"
and ANY b IN d.tract_id SATISFIES b = 7340 END) as tract_name, tract
from Contacts where _type="farm" and tract = "7340"
i get a result which is correct but i don’t like the format of
{
"DocId": "farm::01BE8B24-A7F6-441D-94A1-448B41E1DC6D",
"mailing_address": "Dream Ave LagunaForest CA 92822-1423",
"tract": "7340",
"tract_name": [
{
"name": "Crown Park"
}
]
}
what i would like to get is
{
“DocId”: “farm::01BE8B24-A7F6-441D-94A1-448B41E1DC6D”,
“mailing_address”: " Dream Ave Laguna Forest CA 92822-1423",
“tract”: “7340”,
“tract_name”: “Crown Park”
}
second issue, if i try to use the tract number from the doc but i dont get any data back and i am a bit confused on how to use the “USE Key” in this case
select
meta().id as DocId,
mailingAddress.address || " " || mailingAddress.city || " " || mailingAddress.state || " " || mailingAddress.zip ||"-" || mailingAddress.zip4 as mailing_address,
(select name from Contacts as d where _type ="tract_info"
and ANY b IN d.tract_id SATISFIES b = tract END) tract_name, tract
from Contacts where _type="farm" and tract = "7340"