Graph Traversal/Item Properties

Property Access

Accessing or modifying properties of a node, edge, or vector

Accessing Properties

You can access properties of an item by using the name of the property as defined in the schema.

::{<SchemaFieldNames>}

Example

N::User{
    Name: String, 
    Email: String,
    Age: U32,
    Posts: U32
}

Here we are accessing the Name and Age properties of the first 10 users.

QUERY find_users() =>
    users <- N<User>::RANGE(0, 10)
    RETURN users::{ Name, Age }

Accessing ID

::ID

Here we are accessing the ID of the first 10 users.

QUERY find_users() =>
    users <- N<User>::RANGE(0, 10)
    RETURN users::ID

Spread Operator

Using the spread operator, you can remap values while including all other properties of the selected element in the returned object.

::{
    userID: ID,
    .. 
}

Example

N::User{
    name: String,
    age: U32,
}

Here we are returning properties and remapping the ID field to userID for the first 10 users.

QUERY find_users() =>
    users <- N<User>::RANGE(0, 10)
    RETURN users::{
        userID: ID,
        .. 
    }

On this page