Search code examples
rustsurrealdb

How to find what relations exists between 2 nodes surrealdb?


In neo4j, we can achieve this through the following statement, but how to achieve it in surrealdb?

MATCH (a)-[r]-(b)
WHERE id(a) = node1_id AND id(b) = node2_id
RETURN EXISTS((a)-[r]-(b)) AS is_related

I cannot find a good example on Google or the official documentation to explain that case.


Solution

  • Assuming that I'm reading the Neo4J right (which I've never used before), I think this planned feature is what would be needed:

    https://github.com/surrealdb/surrealdb/issues/3613

    There are some related discussions inside there that include workarounds for the moment.