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

W101

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

Query Has No Return

Erroneous Code Example

This warning occurs when a query does not have a RETURN statement. While not always an error, queries typically should return a value.

QUERY getUser(id: ID) =>
    user <- N<User>(id)
N::User {
    name: String,
}

Solution

Add a RETURN statement to specify what the query should return, or use a mutation operation like INSERT, UPDATE, or DROP if the query is intended to modify data without returning a value.

QUERY getUser(id: ID) =>
    user <- N<User>(id)
    RETURN user
N::User {
    name: String,
}