is there another way for getting the json doc associated with a MAX value? This works because I limit it to 1
SELECT *
FROM myBucket AS buck
LET maxClic = (SELECT RAW MAX(clicks) from myBucket)
WHERE buck.clicks <= maxClic
ORDER BY buck.clicks desc
LIMIT 1
But when I say buck.clicks = maxClic, nothing is returned.
Your suggested query works! thank you. But I have two questions. 1. what is [1] for? in your query. 2. maxClic is a LET in my query which will and always will return 1 value - the MAX. Why do you call it an Array? If it is an array, it’ll always be 1 entry and I’d like to use that 1 entry in other where clauses.