Function collect()
arranges each row of an alias into an array, in their original order, and returns this array. Only one row from the alias will be kept after this function is called, and all the rest rows will be abandoned.
Arguments:
- Any value <any>, auto-abstraction: UUID of NODE/EDGE, row index (starting from 0) of PATH, or the array formed by the elements in the row of TABLE
Returns:
- Array <array>
ATTR
Example: find 10 nodes and collect their schema
find().nodes([1,2,3,4,5,6,7,8,9,10]) as n
return collect(n.@)
NODE
Example: find 10 @product
nodes, collect their UUID
find().nodes({@product}) as n
limit 10
return collect(n)
EDGE
Example: find 10 @transfer
edges, collect their UUID
find().edges({@transfer}) as e
limit 10
return collect(e)
ARRAY
Example: find paths from Card CA001 within 3 steps, collect the ID of the nodes of each path, and collect again all these collections
n({_id == "CA001"}).e()[3].n() as p
with pnodes(p) as a
return collect(a)