Skip to content

both(edgeType, nodeType) ignores nodeType #11

Closed

Description

@michaeloboyle

Problem

both(edgeType, nodeType) ignores nodeType. src/query/TraversalQuery.ts:541 appends

AND EXISTS (SELECT 1 FROM nodes n WHERE n.id = id AND n.type = ?)

to the second UNION branch only, and the unqualified id binds to n.id, so the predicate is always true.

Repro: node a (Person) with a→p (Person), a→c (Company), c2→a (Company):
traverse(a).both('LINK','Person').maxDepth(1).toArray() returns [p, c, c2], expected [p].

The existing test should respect node type filter in both() (tests/unit/TraversalQuery.test.ts:186) already specifies this and fails when run on its own.

Benchmark report: 2026-11-02, Apple M2 Pro, Node 22, at a7f9ea7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions