Skip to main content
Guide
Projection operations turn a traversal stream into the response shape your application needs. They are terminal: a projection finishes that traversal entry.

Choose a projection

Virtual fields include $id, $label, $from, $to, $distance, and $score where the preceding operation provides them.

Rename fields

Project correlated bindings

projectBindings / project_bindings emits one row per traversal result, reading values from names captured earlier with bind. projectDistinctBindings / project_distinct_bindings also removes duplicate projected tuples. When alternative branches bind different names, a row carries only the bindings its own path set. Use coalesce to take the first binding that is present. This request maps each service to a workload ID, whichever branch found it:

Aggregate

Append count() to a filtered traversal and return that named entry; aggregation runs inside the transaction instead of materializing every row in the client.

Keep responses small

  • Project only fields the caller uses.
  • Project $distance before traversing away from a search hit if the score is needed later.
  • Use aggregates in the engine instead of returning full rows for client-side counting.
  • Add distinct only when duplicate elimination is semantically required.

Next steps

Bindings and branches

Preserve row-local values across optional and union operations.

Vector search

Create an index, rank vector hits, and preserve distance metadata.