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

Default Values

⚠️ Warning

HelixQL is deprecated in HelixDB v2. Queries are now written with the Rust DSL and dispatched as JSON — see the Querying guide. This section is kept as a reference for legacy HelixQL projects.

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

Sometimes, you may want to set default values for item fields

N::NodeType {
  field1: String DEFAULT "default",
  field2: U32 DEFAULT 0,
  created_at: Date DEFAULT NOW
}

Helix will use the default value if a value is not provided when inserting the item.

Default value types

TypeExampleDescription
StringDEFAULT "value"Default string literal
NumberDEFAULT 0Default numeric value
TimestampDEFAULT NOWAutomatically set to current timestamp on creation

Example

In the example below, the age field has not been provided when inserting the item so the default value of 0 will be used.

QUERY createUser(name: String) =>
    user <- AddN<User>({name}) 
    RETURN user