79096423

Date: 2024-10-17 03:56:08
Score: 0.5
Natty:
Report link

Nice example! One quick way is to wrap this in return and filtering on the array: https://surrealdb.com/docs/surrealql/datamodel/arrays#mapping-and-filtering-on-arrays

(SELECT id,age, <-parent_of<-(dog WHERE age > 5).* AS parents FROM dog WHERE age < 2)[WHERE parents];

WHERE parents goes into the parents field to see if it is truthy or not (truthy = not NONE, NULL, or an empty value).

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: MacLeod Dave