Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

E621

For the complete documentation index optimized for AI agents, see llms.txt.

Invalid Boolean Comparison

Erroneous Code Example

This error occurs when you try to apply a boolean comparison operation to a type that doesn’t support it.

In this example, the && operator is used on a non-boolean type.

Query getUser(user1: ID, user2: ID) =>
    user1 <- N<User>(user1)
    user2 <- N<User>(user2)
    is_eq <- user1::EQ(user2)
    RETURN is_eq
N::User {
    name: String,
}

Solution

Ensure boolean operations are used on values that result in primitive types like booleans, numbers, or strings.

Query getUser(user1: ID, user2: ID) =>
    user1_name <- N<User>(user1)::{name}
    user2_name <- N<User>(user2)::{name}
    is_eq <- user1_name::EQ(user2_name)
    RETURN is_eq