• Get ancestor paths for a node using graph traversal

    Traverses the graph backwards to find all paths from the node to its ancestors, showing the containment hierarchy (e.g., function -> class -> module -> project).

    Parameters

    • db: Surreal

      SurrealDB instance

    • node: any

      Node object or record ID to get ancestors for

    Returns Promise<any[]>

    Array of ancestor paths, where each path is an array of nodes from child to parent

    const paths = await getNodeAncestorPaths(db, myNode);
    // Returns: [[childNode, parentNode, grandparentNode], [...]]