Represents the result set of a graph query execution containing vertices, edges or scalar values depending on the query.

It allows iteration of the items using for..of statements under ES2015 and exposes forEach(), first() and toArray() to access the underlying items.

Members

Object

info

Information on the execution of a successful query:

Properties:
Name Type Description
achievedConsistency Number

The consistency level that has been actually achieved by the query.

queriedHost String

The Cassandra host that coordinated this query.

triedHosts Object

Gets the associative array of host that were queried before getting a valid response, being the last host the one that replied correctly.

traceId Uuid

Identifier of the trace session.

warnings Array<string>

Warning messages generated by the server when executing the query.

Number

length

This property has been deprecated because it may return a lower value than the actual length of the results. Use toArray() instead.

Gets the length of the result.

String

pageState

A string token representing the current page state of query. It can be used in the following executions to continue paging and retrieve the remained of the result for the query.

Constructor

new

GraphResultSet

(ResultSet result, [function rowParser])

Creates a new instance of GraphResultSet.

Examples:
for (let vertex of result} { ... }
const arr = result.toArray();
const vertex = result.first();
Parameters:
Name Type Description
result ResultSet
rowParser optional function

Methods

first

()

Returns the first element of the result or null if the result is empty.

Returns:
Type Description
Object

forEach

(function callback, [Object thisArg])

Executes a provided function once per result element.

Parameters:
Name Type Description
callback function

Function to execute for each element, taking two arguments: currentValue and index.

thisArg optional Object

Value to use as this when executing callback.

toArray

()

Results an Array of graph result elements (vertex, edge, scalar).

Returns:
Type Description
Array

values

()

Returns a new Iterator object that contains the values for each index in the result.

Returns:
Type Description
Object