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

projectDistinctBindings removes duplicate projected tuples. Missing optional bindings remain row-local and can be handled with coalesce. Bind each candidate path first, then project BindingProjection values from those named row-local bindings.

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.