I need some help with retrieving results from my bucket based on a value in a nested array in my document.
Running the query below:
SELECT * FROM server-bucket-name
AS blacklist WHERE blacklist.type=“blacklist”;
"results": [
{
"blacklist": {
"list": [
{
"blackListedBy": "Jason",
"entryDateTime": "09172015221459",
"lookupID": "U-53267",
"memberID": "M-983-34A",
"reasonID": "809"
},
{
"blackListedBy": "System",
"entryDateTime": "09172015221459",
"lookupID": "U-02246",
"memberID": "M-526-92P",
"reasonID": "605"
},
{
"blackListedBy": "Debbie",
"entryDateTime": "09172015221459",
"lookupID": "U-82354",
"memberID": "M-675-J45",
"reasonID": "352"
}
],
"type": "blacklist"
}
} ]
I tried the N1QL statement below:
SELECT *
FROM server-bucket-name
AS blacklist
WHERE type="blacklist"
AND EVERY blacklisted IN blacklist.list
SATISFIES blacklisted.lookupID = “U-53267” END;
Statement above is successful with no results, also tried using an unnest statement geraldss recommended here:
SELECT b.lookupID
FROM server-bucket-name
b
UNNEST b.list l
WHERE l.lookupID = “U-53267”;
That returned no results as well. When I reconstruct these statements for the tutorial bucket I also have running on my sandbox I do get results back.
Keep wondering what it is I’m missing. Any help would be greatly appreciated.
Thanks