Represents the result of an execution as an iterable of objects in the Mapper.

Members

Number

length

Gets the amount of the documents contained in this Result instance.

When the results are paged, it returns the length of the current paged results not the total amount of rows in the table matching the query.

String

pageState

A string token representing the current page state of query.

When provided, it can be used in the following executions to continue paging and retrieve the remained of the result for the query.

Constructor

new

Result

(ResultSet rs, ModelMappingInfo info, function rowAdapter)

Creates a new instance of Result.

Parameters:
Name Type Description
rs ResultSet
info ModelMappingInfo
rowAdapter function

Methods

Symbol.iterator

()

Returns a new Iterator object that contains the document values.

first

()

Gets the first document in this result or null when the result is empty.

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

()

Converts the current instance to an Array of documents.

Returns:
Type Description
Array<Object>

wasApplied

()

When this instance is the result of a conditional update query, it returns whether it was successful. Otherwise, it returns true.

For consistency, this method always returns true for non-conditional queries (although there is no reason to call the method in that case). This is also the case for conditional DDL statements (CREATE KEYSPACE… IF NOT EXISTS, CREATE TABLE… IF NOT EXISTS), for which the server doesn’t return information whether it was applied or not.