Skip to content

List operators

List operators are:

  • concatenating lists: +
  • checking if an element exists in a list: IN
  • accessing an element(s) in a list using the subscript operator: []

Examples

nebula> YIELD [1,2,3,4,5]+[6,7] AS myList
+-----------------------+
| myList                |
+-----------------------+
| [1, 2, 3, 4, 5, 6, 7] |
+-----------------------+

nebula> RETURN size([NULL, 1, 2])
+------------------+
| size([NULL,1,2]) |
+------------------+
| 3                |
+------------------+

nebula> RETURN NULL IN [NULL, 1]
+--------------------+
| (NULL IN [NULL,1]) |
+--------------------+
| true               |
+--------------------+

nebula> WITH [2, 3, 4, 5] AS numberlist \
    UNWIND numberlist AS number \
    WITH number \
    WHERE number IN [2, 3, 8] \
    RETURN number
+--------+
| number |
+--------+
| 2      |
+--------+
| 3      |
+--------+

Last update: March 17, 2021
Back to top