RETURN clause. You can return bindings (variables),
projected properties, aggregations, literals, or choose to return nothing at all.
Quick reference
| Return Type | Syntax | Return Type | Syntax |
|---|---|---|---|
| Return a binding | RETURN users | Exclude fields | RETURN users::!{ email } |
| Return multiple | RETURN user, posts | Aggregation/scalar | RETURN count |
| Project fields | RETURN users::{ name, age } | Literal | RETURN "ok" |
| Only IDs | RETURN users::ID | No payload | RETURN NONE |
Response structure
Every HelixQL response is a JSON object whose top-level keys are the binding names used inRETURN. The value for each key depends on how many elements the binding holds:
| Binding selects | Example syntax | Value shape |
|---|---|---|
| Multiple elements | N<User> | Array of objects |
| Single element (by ID) | N<User>(user_id) | Single object |
| Traversal results | user::Out<Follows> | Array of objects |
| Scalar / aggregation | N<User>::COUNT | Single value |
Element object shapes
Every element returned by HelixDB includes anid field (a UUID string) alongside its
schema-defined properties.
Node
from and to fields referencing the connected node IDs, plus
any properties defined in the Properties block of the schema.
When you use property projection (
::{ name, age }),
only the fields you list are returned — id is not included unless you explicitly
request it (e.g. ::{ userID: ::ID, name }). When you use
property exclusion (::!{ email }), id is still
included because it is not a schema-defined property.Returning bindings
Return any previously bound value from your traversal.Returning projections and properties
Use property projection to shape the returned data.ID of each element:
RETURN using nested mappings:
Returning scalars and literals
Aggregations and scalar bindings can be returned directly:Returning nothing
For mutations or maintenance operations where you do not want a response payload, useRETURN NONE.
RETURN NONE signals that the query intentionally produces no output values. This is
handy to avoid sending placeholder strings like “success” when a silent acknowledgement
is preferred.