DEV Community

Indigo Norrbottenspets
Indigo Norrbottenspets

Posted on

Neo4j: List expressions

size($list)
Enter fullscreen mode Exit fullscreen mode

Number of elements in the list.

reverse($list)
Enter fullscreen mode Exit fullscreen mode

Reverse the order of the elements in the list.

head($list), last($list), tail($list)
Enter fullscreen mode Exit fullscreen mode

head() returns the first, last() the last element of the list. tail() returns all but the first element. All return null for an empty list.

[x IN list | x.prop]
Enter fullscreen mode Exit fullscreen mode

A list of the value of the expression for each element in the original list.

[x IN list WHERE x.prop <> $value]
Enter fullscreen mode Exit fullscreen mode

A filtered list of the elements where the predicate is true.

[x IN list WHERE x.prop <> $value | x.prop]
Enter fullscreen mode Exit fullscreen mode

A list comprehension that filters a list and extracts the value of the expression for each element in that list.

reduce(s = "", x IN list | s + x.prop)
Enter fullscreen mode Exit fullscreen mode

Evaluate expression for each element in the list, accumulate the results.

Useful links

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more