Global

Members

(constant) Integer

Deprecated:
  • Integer is deprecated. See `./types/integer.js`
Source:

(constant) allocBuffer :function

Forward-compatible allocation of buffer, filled with zeros.

Type:
  • function
Source:

(constant) allocBufferFromArray :function

Forward-compatible allocation of buffer from an array of bytes

Type:
  • function
Source:

(constant) allocBufferFromString :function

Forward-compatible allocation of buffer to contain a string.

Type:
  • function
Source:

(constant) allocBufferUnsafe :function

Forward-compatible unsafe allocation of buffer.

Type:
  • function
Source:

(constant) coreConnectionsPerHostV2

Core connections per host for protocol versions 1 and 2

Source:

(constant) coreConnectionsPerHostV3

Core connections per host for protocol version 3 and above

Source:

(constant) emptyArray

Source:

(constant) emptyObject

Source:

(constant) maxInt :number

Max int that can be accurately represented with 64-bit Number (2^53)

Type:
  • number
Source:

(constant) maxRequestsPerConnectionV2

Default maxRequestsPerConnection value for protocol v1 and v2

Source:

(constant) maxRequestsPerConnectionV3

Default maxRequestsPerConnection value for protocol v3+

Source:

Methods

adaptNamedParamsPrepared(params, columns) → {Array}

Adapts the parameters based on the prepared metadata. If the params are passed as an associative array (Object), it adapts the object into an array with the same order as columns

Parameters:
Name Type Description
params Array | Object
columns Array
Source:
Throws:

In case a parameter with a specific name is not defined

Type
Error
Returns:

Returns an array of parameters.

Type
Array

adaptNamedParamsWithHints(params, execOptions) → {Object}

Adapts the associative-array of parameters and hints for simple statements into Arrays based on the (arbitrary) position of the keys.

Parameters:
Name Type Description
params Array | Object
execOptions ExecutionOptions
Source:
Returns:

Returns an array of parameters and the keys as an associative array.

Type
Object

arbitraryValueToBigInt(value)

Ensure the value is one of the accepted numeric types, and convert them to BigInt

Parameters:
Name Type Description
value string | number | Long | BigInt
Source:

arrayIterator(arr) → {Iterator}

Uses the iterator protocol to go through the items of the Array

Parameters:
Name Type Description
arr Array
Source:
Returns:
Type
Iterator

bigintToLong(from) → {Long}

Converts from bigint provided by napi into Long type used by the datastax library BigInt is the way napi handles values too big for js Number type, while Long is the way datastax code handles 64-bit integers.

Parameters:
Name Type Description
from bigint
Source:
Returns:
Type
Long

binarySearch(arr, key, compareFunc) → {number}

Searches the specified Array for the provided key using the binary search algorithm. The Array must be sorted.

Parameters:
Name Type Description
arr Array
key
compareFunc function
Source:
Returns:

The position of the key in the Array, if it is found. If it is not found, it returns a negative number which is the bitwise complement of the index of the first element that is larger than key.

Type
number

callbackOnce(callback) → {function}

Parameters:
Name Type Description
callback function
Source:
Returns:

Returns a wrapper function that invokes the underlying callback only once.

Type
function

convertHints(hints) → {Array.<(rust.ComplexType|null)>}

Convert the hints from the formats allowed by the driver, to internal type representation

Parameters:
Name Type Description
hints Array.<(string|number|object|null)>
Source:
Returns:
Type
Array.<(rust.ComplexType|null)>

copyBuffer()

Creates a copy of a buffer

Source:

deepExtend(target) → {Object}

Extends the target by the most inner props of sources

Parameters:
Name Type Description
target Object
Source:
Returns:
Type
Object

defaultOptions() → {ClientOptions}

Source:
Returns:
Type
ClientOptions

defaultPromiseFactory(handler) → {Promise}

Parameters:
Name Type Description
handler function
Source:
Returns:
Type
Promise

delay(ms) → {Promise.<void>}

Creates a non-clearable timer that resolves the promise once elapses.

Parameters:
Name Type Description
ms number
Source:
Returns:
Type
Promise.<void>

each(arr, fn, callbackopt)

Parameters:
Name Type Attributes Description
arr Array
fn function
callback function <optional>
Source:

eachSeries(arr, fn, callbackopt)

Parameters:
Name Type Attributes Description
arr Array
fn function
callback function <optional>
Source:

encodeListLike(values, subtype) → {Array.<(rust.ComplexType|Array.<any>)>}

Wraps each of the elements into given subtype

Parameters:
Name Type Description
values Array
subtype rust.ComplexType
Source:
Returns:

Returns tuple: [rust.ComplexType, any[]]

Type
Array.<(rust.ComplexType|Array.<any>)>

encodeMap(value, parentType) → {Array.<(rust.ComplexType|Array.<Array.<any>>)>}

Parameters:
Name Type Description
value *
parentType rust.ComplexType
Source:
Returns:

Returns tuple: [rust.ComplexType, any[][]]

Type
Array.<(rust.ComplexType|Array.<Array.<any>>)>

encodeTuple(value, type) → {Array.<(rust.ComplexType|Array.<any>)>}

Wraps tuple into format recognized by ParameterWrapper

Parameters:
Name Type Description
value types.Tuple
type rust.ComplexType
Source:
Returns:

Returns tuple: [rust.ComplexType, Array]

Type
Array.<(rust.ComplexType|Array.<any>)>

encodeVector(value, params)

Parameters:
Name Type Description
value CqlVector
params Object
Source:

ensureNumber(value)

Ensures the provided value is non NaN. If it is, throws an error

Parameters:
Name Type Description
value any
Source:

ensureValue(message)

Ensures the value isn't one of many ways to express null value

Parameters:
Name Type Description
message string

Error message if value is "null"

Source:
Throws:

Throws an error if the value is "null"

Type
TypeError

extend(baseOptionsopt, userOptions) → {Object}

Extends and validates the user options

Parameters:
Name Type Attributes Description
baseOptions Object <optional>

The source object instance that will be overridden

userOptions Object
Source:
Returns:
Type
Object

extend()

Merge the contents of two or more objects together into the first object. Similar to jQuery.extend / Object.assign. The main difference between this method is that declared properties with an undefined value are not set to the target.

Source:

fixStack()

Appends the original stack trace to the error after a tick of the event loop

Source:

forEachOf(arr, fn, callbackopt)

Parameters:
Name Type Attributes Description
arr Array
fn function
callback function <optional>
Source:

fromCallback(fn) → {Promise}

Creates a Promise from a callback based function.

Parameters:
Name Type Description
fn function
Source:
Returns:
Type
Promise

fromEvent(emitter, eventName) → {Promise}

Creates a Promise that gets resolved or rejected based on an event.

Parameters:
Name Type Description
emitter object
eventName string
Source:
Returns:
Type
Promise

getCallback(resolve, reject) → {function}

Gets a function that has the signature of a callback that invokes the appropriate promise handler parameters.

Parameters:
Name Type Description
resolve function
reject function
Source:
Returns:
Type
function

getColumnsMetadata(result) → {Array.<{name, type}>}

Parameters:
Name Type Description
result rust.QueryResultWrapper
Source:
Returns:
Type
Array.<{name, type}>

getCqlObject(field) → {any}

Maps the value returned from the Rust driver into expected JS object.

This function accepts the following kinds of arguments:

  1. Value -> When can correctly handle the value based on the type;
  2. [Type, Value] -> In case of ambiguity, rust side provides tuple of (CqlType, Value). Specifically, array based types will always be returned in this form.

See rust.CqlValueWrapper, for more information

Parameters:
Name Type Description
field rust.CqlValueWrapper
Source:
Returns:
Type
any

getRowsFromResultsWrapper(result) → {Array.<Row>|undefined}

Simple way of getting results from rust driver. Call the driver O(columns * rows) times

Parameters:
Name Type Description
result rust.QueryResultWrapper
Source:
Returns:

Returns array of rows if ResultWrapper has any, and undefined otherwise

Type
Array.<Row> | undefined

getWrapped(type, value) → {Array.<(rust.ComplexType|any)>}

Wraps value into format recognized by ParameterWrapper, based on the provided type

Parameters:
Name Type Description
type rust.ComplexType
value *
Source:
Returns:

Returns tuple: [rust.ComplexType, any] or []

Type
Array.<(rust.ComplexType|any)>

guessTypeChecked(value) → {rust.ComplexType}

Guess the type, and if the type cannot be guessed, throw an error.

Parameters:
Name Type Description
value any
Source:
Returns:

type guess, converted to ComplexType object

Type
rust.ComplexType

ifUndefined()

Returns the first not undefined param

Source:

ifUndefined3()

Returns the first not undefined param

Source:

insertSorted(arr, item, compareFunc)

Inserts the value in the position determined by its natural order determined by the compare func

Parameters:
Name Type Description
arr Array
item
compareFunc function
Source:

iteratorToArray(iterator) → {Array}

Convert the iterator values into an array

Parameters:
Name Type Description
iterator
Source:
Returns:
Type
Array

log(type, info, furtherInfoopt)

Uses the logEmitter to emit log events

Parameters:
Name Type Attributes Description
type String
info String
furtherInfo <optional>
Source:

longToBigint(from) → {bigint}

Converts from Long type used by the datastax library into bigint used by napi

Parameters:
Name Type Description
from Long
Source:
Returns:
Type
bigint

map(arr, fn, callbackopt)

Parameters:
Name Type Attributes Description
arr Array
fn function
callback function <optional>
Source:

mapSeries(arr, fn, callbackopt)

Parameters:
Name Type Attributes Description
arr Array
fn function
callback function <optional>
Source:

napiErrorHandler(fn) → {function}

A wrapper function to map napi errors to Node.js errors or custom errors. Because NAPI-RS does not support throwing errors different that Error, for example TypeError, RangeError, etc. or custom, driver-specific errors, this function is used to catch the original error and throw a new one with the appropriate type. This should be used to wrap all NAPI-RS functions that may throw errors.

Parameters:
Name Type Description
fn function

The original function to be wrapped.

Source:
Returns:

A wrapped function with error handling logic.

Type
function

newQueryPlan(lbp, keyspace, executionOptions) → {Promise.<Iterator>}

Invokes the new query plan of the load balancing policy and returns a Promise.

Parameters:
Name Type Description
lbp LoadBalancingPolicy

The load balancing policy.

keyspace String

Name of currently logged keyspace at Client level.

executionOptions ExecutionOptions | null

The information related to the execution of the request.

Source:
Returns:
Type
Promise.<Iterator>

objectValues(obj) → {Array}

Returns an array containing the values of the Object, similar to Object.values(). If obj is null or undefined, it will return an empty array.

Parameters:
Name Type Description
obj Object
Source:
Returns:
Type
Array

optionalCallback(promise, callbacknullable) → {Promise|undefined}

Method that handles optional callbacks (dual promise and callback support). When callback is undefined it returns the promise. When using a callback, it will use it as handlers of the continuation of the promise.

Parameters:
Name Type Attributes Description
promise Promise
callback function <nullable>
Source:
Returns:
Type
Promise | undefined

parallel(arr, callbackopt)

Parameters:
Name Type Attributes Description
arr Array.<function()>
callback function <optional>
Source:

parseParams(expectedTypes, params, allowGuessingopt) → {Array.<(rust.ComplexType|any)>}

Parses array of params into expected format according to preparedStatement expected types

If allowGuessing is true, then for each missing field of expectedTypes, this function will try to guess a type. If the type cannot be guessed, error will be thrown. Field is missing if it is null, undefined or if the expectedTypes list is too short.

Parameters:
Name Type Attributes Description
expectedTypes Array.<(rust.ComplexType|null)>

List of expected types.

params Array.<any>
allowGuessing boolean <optional>
Source:
Throws:

ResponseError when received different amount of parameters than expected

Returns:

Returns: [] for null values, [undefined] for unset values and [rust.ComplexType, any] for all other values.

Type
Array.<(rust.ComplexType|any)>

parseVectorTypeArgs(typeName, stringToExclude, subtypeResolveFn) → {Object}

Extract the (typed) arguments from a vector type

Parameters:
Name Type Description
typeName String
stringToExclude String

Leading string indicating this is a vector type (to be excluded when eval'ing args)

subtypeResolveFn function

Function used to resolve subtype type; varies depending on type naming convention

Source:
Returns:
Type
Object

promiseWrapper(options, originalCallback, handler) → {Promise|undefined}

Wraps the callback-based method. When no originalCallback is not defined, it returns a Promise.

Parameters:
Name Type Description
options ClientOptions
originalCallback function
handler function
Source:
Returns:
Type
Promise | undefined

(package) queryOptionsIntoWrapper(options) → {rust.QueryOptionsWrapper}

Parses js query options into rust query options wrapper

Parameters:
Name Type Description
options _execOptions.ExecutionOptions
Source:
Returns:
Type
rust.QueryOptionsWrapper

rustConvertHint(object) → {rust.ComplexType|null}

Parameters:
Name Type Description
object null | object | Array.<object>
Source:
Returns:
Type
rust.ComplexType | null

series(arr, callbackopt)

Similar to async.series(), but instead accumulating the result in an Array, it callbacks with the result of the last function in the array.

Parameters:
Name Type Attributes Description
arr Array.<function()>
callback function <optional>
Source:

setMetadataDependent(client)

Sets the default options that depend on the protocol version and other metadata.

Parameters:
Name Type Description
client Client
Source:

stringRepeat(val, times) → {String}

Returns a string with a value repeated n times

Parameters:
Name Type Description
val String
times Number
Source:
Returns:
Type
String

throwNotSupported(entity, name)

Parameters:
Name Type Description
entity String
name String
Source:

times(count, limit, fn) → {Promise}

Invokes the provided function multiple times, considering the concurrency level limit.

Parameters:
Name Type Description
count Number
limit Number
fn function
Source:
Returns:
Type
Promise

times(count, iteratorFunc, callbackopt)

Parameters:
Name Type Attributes Description
count Number
iteratorFunc function
callback function <optional>
Source:

timesLimit(count, limit, iteratorFunc, callbackopt)

Parameters:
Name Type Attributes Description
count Number
limit Number
iteratorFunc function
callback function <optional>
Source:

timesSeries(count, iteratorFunction, callback)

Parameters:
Name Type Description
count Number
iteratorFunction function
callback function
Source:

toBackground(promise) → {undefined}

Deals with unexpected rejections in order to avoid the unhandled promise rejection warning or failure.

Parameters:
Name Type Description
promise Promise
Source:
Returns:
Type
undefined

toCallback(promise, callbacknullable) → {undefined}

Invokes the callback once outside the promise chain the promise is resolved or rejected.

Parameters:
Name Type Attributes Description
promise Promise
callback function <nullable>
Source:
Returns:
Type
undefined

toLowerCaseProperties()

Returns a new object with the property names set to lowercase.

Source:

totalLength()

Gets the sum of the length of the items of an array

Source:

validateFn(fn, nameopt) → {function}

Validates the provided parameter is of type function.

Parameters:
Name Type Attributes Description
fn function

The instance to validate.

name String <optional>

Name of the function to use in the error message. Defaults to 'callback'.

Source:
Returns:
Type
function

whilst(condition, fn, callback)

Parameters:
Name Type Description
condition function
fn function
callback function
Source:

wrapValueBasedOnType(type, value) → {Array.<(rust.ComplexType|any)>}

Wrap value, which is not Unset, into type and value pair, ensuring value is converted into expected form

Parameters:
Name Type Description
type rust.ComplexType
value *
Source:
Returns:

Returns tuple: [rust.ComplexType, any]

Type
Array.<(rust.ComplexType|any)>

Type Definitions

ClientOptions

Client options.

While the driver provides lots of extensibility points and configurability, few client options are required.

Default values for all settings are designed to be suitable for the majority of use cases, you should avoid fine tuning it when not needed.

See Client constructor documentation for recommended options.

Type:
  • Object
Properties:
Name Type Attributes Description
contactPoints Array.<string>

Array of addresses or host names of the nodes to add as contact points.

Contact points are addresses of Cassandra nodes that the driver uses to discover the cluster topology.

Only one contact point is required (the driver will retrieve the address of the other nodes automatically), but it is usually a good idea to provide more than one contact point, because if that single contact point is unavailable, the driver will not be able to initialize correctly.

localDataCenter String <optional>

The local data center to use.

If using DCAwareRoundRobinPolicy (default), this option is required and only hosts from this data center are connected to and used in query plans.

[TODO: Add support for this field]

keyspace String <optional>

The logged keyspace for all the connections created within the Client instance.

credentials Object <optional>

An object containing the username and password for plain-text authentication. It configures the authentication provider to be used against Apache Cassandra's PasswordAuthenticator or DSE's DseAuthenticator, when default auth scheme is plain-text.

Note that you should configure either credentials or authProvider to connect to an auth-enabled cluster, but not both.

Properties
Name Type Attributes Description
username String <optional>

The username to use for plain-text authentication.

password String <optional>

The password to use for plain-text authentication.

id Uuid <optional>

A unique identifier assigned to a Client object, that will be communicated to the server (DSE 6.0+) to identify the client instance created with this options. When not defined, the driver will generate a random identifier. [TODO: Add support for this field]

applicationName String <optional>

An optional setting identifying the name of the application using the Client instance.

This value is passed to DSE and is useful as metadata for describing a client connection on the server side.

[TODO: Add support for this field]

applicationVersion String <optional>

An optional setting identifying the version of the application using the Client instance.

This value is passed to DSE and is useful as metadata for describing a client connection on the server side.

[TODO: Add support for this field]

monitorReporting Object <optional>

Options for reporting mechanism from the client to the DSE server, for versions that support it. [TODO: Add support for this field]

Properties
Name Type Attributes Default Description
enabled Boolean <optional>
true

Determines whether the reporting mechanism is enabled. Defaults to true. [TODO: Add support for this field]

cloud Object <optional>

The options to connect to a cloud instance. [TODO: Add support for this field Remove?]

Properties
Name Type Description
secureConnectBundle String | URL

Determines the file path for the credentials file bundle. [TODO: Add support for this field Remove?]

refreshSchemaDelay Number <optional>

The default window size in milliseconds used to debounce node list and schema refresh metadata requests. Default: 1000. [TODO: Add support for this field]

isMetadataSyncEnabled Boolean <optional>

Determines whether client-side schema metadata retrieval and update is enabled.

Setting this value to false will cause keyspace information not to be automatically loaded, affecting replica calculation per token in the different keyspaces. When disabling metadata synchronization, use Metadata.refreshKeyspaces() to keep keyspace information up to date or token-awareness will not work correctly.

Default: true. [TODO: Add support for this field]

prepareOnAllHosts Boolean <optional>

Determines if the driver should prepare queries on all hosts in the cluster. Default: true. [TODO: Add support for this field]

rePrepareOnUp Boolean <optional>

Determines if the driver should re-prepare all cached prepared queries on a host when it marks it back up. Default: true. [TODO: Add support for this field]

maxPrepared Number <optional>

Determines the maximum amount of different prepared queries before evicting items from the internal cache. Reaching a high threshold hints that the queries are not being reused, like when hard-coding parameter values inside the queries. Default: 512.

policies Object <optional>

[TODO: Add support for this field]

Properties
Name Type Attributes Description
loadBalancing LoadBalancingPolicy <optional>

The load balancing policy instance to be used to determine the coordinator per query. [TODO: Add support for this field]

retry RetryPolicy <optional>

The retry policy. [TODO: Add support for this field]

reconnection ReconnectionPolicy <optional>

The reconnection policy to be used. [TODO: Add support for this field]

addressResolution AddressTranslator <optional>

The address resolution policy. [TODO: Add support for this field]

speculativeExecution SpeculativeExecutionPolicy <optional>

The SpeculativeExecutionPolicy instance to be used to determine if the client should send speculative queries when the selected host takes more time than expected.

Default: NoSpeculativeExecutionPolicy

[TODO: Add support for this field]

timestampGeneration TimestampGenerator <optional>

The client-side query timestamp generator.

Default: MonotonicTimestampGenerator

Use null to disable client-side timestamp generation.

[TODO: Add support for this field]

queryOptions QueryOptions <optional>

Default options for all queries. [TODO: Add support for this field]

pooling Object <optional>

Pooling options. [TODO: Add support for this field]

Properties
Name Type Attributes Description
heartBeatInterval Number <optional>

The amount of idle time in milliseconds that has to pass before the driver issues a request on an active connection to avoid idle time disconnections. Default: 30000. [TODO: Add support for this field]

coreConnectionsPerHost Object <optional>

Associative array containing amount of connections per host distance. [TODO: Add support for this field]

maxRequestsPerConnection Number <optional>

The maximum number of requests per connection. The default value is:

  • For modern protocol versions (v3 and above): 2048
  • For older protocol versions (v1 and v2): 128

[TODO: Add support for this field]

warmup Boolean <optional>

Determines if all connections to hosts in the local datacenter must be opened on connect. Default: true. [TODO: Add support for this field]

protocolOptions Object <optional>

[TODO: Add support for this field]

Properties
Name Type Attributes Description
port Number <optional>

The port to use to connect to the Cassandra host. If not set through this method, the default port (9042) will be used instead. [TODO: Add support for this field]

maxSchemaAgreementWaitSeconds Number <optional>

The maximum time in seconds to wait for schema agreement between nodes before returning from a DDL query. Default: 10. [TODO: Add support for this field]

maxVersion Number <optional>

When set, it limits the maximum protocol version used to connect to the nodes. Useful for using the driver against a cluster that contains nodes with different major/minor versions of Cassandra. [TODO: Add support for this field]

noCompact Boolean <optional>

When set to true, enables the NO_COMPACT startup option.

When this option is supplied SELECT, UPDATE, DELETE, and BATCH statements on COMPACT STORAGE tables function in "compatibility" mode which allows seeing these tables as if they were "regular" CQL tables.

This option only effects interactions with interactions with tables using COMPACT STORAGE and is only supported by C* 3.0.16+, 3.11.2+, 4.0+ and DSE 6.0+.

[TODO: Add support for this field]

socketOptions Object <optional>

[TODO: Add support for this field]

Properties
Name Type Attributes Description
connectTimeout Number <optional>

Connection timeout in milliseconds. Default: 5000. [TODO: Add support for this field]

defunctReadTimeoutThreshold Number <optional>

Determines the amount of requests that simultaneously have to timeout before closing the connection. Default: 64. [TODO: Add support for this field]

keepAlive Boolean <optional>

Whether to enable TCP keep-alive on the socket. Default: true. [TODO: Add support for this field]

keepAliveDelay Number <optional>

TCP keep-alive delay in milliseconds. Default: 0. [TODO: Add support for this field]

readTimeout Number <optional>

Per-host read timeout in milliseconds.

Please note that this is not the maximum time a call to Client#execute may have to wait; this is the maximum time that call will wait for one particular Cassandra host, but other hosts will be tried if one of them timeout. In other words, a Client#execute call may theoretically wait up to readTimeout * number_of_cassandra_hosts (though the total number of hosts tried for a given query also depends on the LoadBalancingPolicy in use).

When setting this value, keep in mind the following:

  • the timeout settings used on the Cassandra side (*_request_timeout_in_ms in cassandra.yaml) should be taken into account when picking a value for this read timeout. You should pick a value a couple of seconds greater than the Cassandra timeout settings.
  • the read timeout is only approximate and only control the timeout to one Cassandra host, not the full query.

Setting a value of 0 disables read timeouts. Default: 12000. [TODO: Add support for this field]

tcpNoDelay Boolean <optional>

When set to true, it disables the Nagle algorithm. Default: true. [TODO: Add support for this field]

coalescingThreshold Number <optional>

Buffer length in bytes use by the write queue before flushing the frames. Default: 8000. [TODO: Add support for this field]

authProvider AuthProvider <optional>

Provider to be used to authenticate to an auth-enabled cluster. [TODO: Add support for this field]

requestTracker RequestTracker <optional>

The instance of RequestTracker used to monitor or log requests executed with this instance. [TODO: Add support for this field]

sslOptions Object <optional>

Client-to-node ssl options. When set the driver will use the secure layer. You can specify cert, ca, ... options named after the Node.js tls.connect() options.

It uses the same default values as Node.js tls.connect() except for rejectUnauthorized which is set to false by default (for historical reasons). This setting is likely to change in upcoming versions to enable validation by default.

[TODO: Add support for this field]

encoding Object <optional>

Encoding options. [TODO: Add support for this field]

Properties
Name Type Attributes Description
map function <optional>

Map constructor to use for Cassandra map<k,v> type encoding and decoding. If not set, it will default to Javascript Object with map keys as property names. [TODO: Add support for this field]

set function <optional>

Set constructor to use for Cassandra set type encoding and decoding. If not set, it will default to Javascript Array. [TODO: Add support for this field]

copyBuffer Boolean <optional>

Determines if the network buffer should be copied for buffer based data types (blob, uuid, timeuuid and inet).

Setting it to true will cause that the network buffer is copied for each row value of those types, causing additional allocations but freeing the network buffer to be reused. Setting it to true is a good choice for cases where the Row and ResultSet returned by the queries are long-lived objects.

Setting it to false will cause less overhead and the reference of the network buffer to be maintained until the row / result set are de-referenced. Default: true.

[TODO: Add support for this field]

useUndefinedAsUnset Boolean <optional>

Valid for Cassandra 2.2 and above. Determines that, if a parameter is set to undefined it should be encoded as unset.

By default, ECMAScript undefined is encoded as null in the driver. Cassandra 2.2 introduced the concept of unset. At driver level, you can set a parameter to unset using the field types.unset. Setting this flag to true allows you to use ECMAScript undefined as Cassandra unset.

Default: true.

[TODO: Add support for this field]

useBigIntAsLong Boolean <optional>

Use BigInt ECMAScript type to represent CQL bigint and counter data types. [TODO: Add support for this field]

useBigIntAsVarint Boolean <optional>

Use BigInt ECMAScript type to represent CQL varint data type.

Note, that using Integer as Varint (useBigIntAsVarint == false) is deprecated. [TODO: Add support for this field]

profiles Array.<ExecutionProfile> <optional>

The array of execution profiles. [TODO: Add support for this field]

promiseFactory function <optional>

Function to be used to create a Promise from a callback-style function.

Promise libraries often provide different methods to create a promise. For example, you can use Bluebird's Promise.fromCallback() method.

By default, the driver will use the Promise constructor.

[TODO: Add support for this field]

Source:

QueryOptions

Query options

Type:
  • Object
Properties:
Name Type Attributes Description
autoPage boolean <optional>

Determines if the driver must retrieve the following result pages automatically.

This setting is only considered by the Client#eachRow() method. For more information, check the paging results documentation.

captureStackTrace boolean <optional>

Determines if the stack trace before the query execution should be maintained.

Useful for debugging purposes, it should be set to false under production environment as it adds an unnecessary overhead to each execution.

Default: false. [TODO: Add support for this field]

consistency number <optional>

Consistency level.

Defaults to localOne for Apache Cassandra and ScyllaDB deployments.

[TODO: Test this field]

customPayload Object <optional>

Key-value payload to be passed to the server. On the Cassandra side, implementations of QueryHandler can use this data. [TODO: Add support for this field]

executionProfile string | ExecutionProfile <optional>

Name or instance of the profile to be used for this execution. If not set, it will the use "default" execution profile. [TODO: Add support for this field]

fetchSize number <optional>

Amount of rows to retrieve per page. Only valid if query is paged.

hints Array | Array.<Array> <optional>

Type hints for parameters given in the query, ordered as for the parameters.

For batch queries, an array of such arrays, ordered as with the queries in the batch.

host Host <optional>

The host that should handle the query.

Use of this option is heavily discouraged and should only be used in the following cases:

  1. Querying node-local tables, such as tables in the system and system_views keyspaces.
  2. Applying a series of schema changes, where it may be advantageous to execute schema changes in sequence on the same node.

Configuring a specific host causes the configured LoadBalancingPolicy to be completely bypassed. However, if the load balancing policy dictates that the host is at a distance of ignored or there is no active connectivity to the host, the request will fail with a NoHostAvailableError.

idempotent boolean <optional>

Defines whether the query can be applied multiple times without changing the result beyond the initial application.

The query execution idempotence can be used at RetryPolicy level to determine if an statement can be retried in case of request error or write timeout.

Default: false.

[TODO: Add support for this field]

keyspace string <optional>

Specifies the keyspace for the query. It is used for the following:

  1. To indicate what keyspace the statement is applicable to (protocol V5+ only). This is useful when the query does not provide an explicit keyspace and you want to override the current Client#keyspace.
  2. For query routing when the query operates on a different keyspace than the current Client#keyspace.

[TODO: Add support for this field]

logged boolean <optional>

Determines if the batch should be written to the batchlog. Only valid for Client#batch(), it will be ignored by other methods. Default: true. [TODO: Add support for this field]

counter boolean <optional>

Determines if its a counter batch. Only valid for Client#batch(), it will be ignored by other methods. Default: false. [TODO: Add support for this field]

paged boolean <optional>

Determines if the query should be paged. Default: true.

pageState Buffer | string <optional>

Buffer or string token representing the paging state.

Useful for manual paging, if provided, the query will be executed starting from a given paging state. [TODO: Add support for this field]

prepare boolean <optional>

Determines if the query must be executed as a prepared statement.

readTimeout number <optional>

When defined, it overrides the default read timeout (socketOptions.readTimeout) in milliseconds for this execution per coordinator.

Suitable for statements for which the coordinator may allow a longer server-side timeout, for example aggregation queries.

A value of 0 disables client side read timeout for the execution. Default: undefined.

[TODO: Add support for this field]

retry RetryPolicy <optional>

Retry policy for the query.

This property can be used to specify a different retry policy to the one specified in the ClientOptions.policies. [TODO: Add support for this field]

routingIndexes Array <optional>

Index of the parameters that are part of the partition key to determine the routing. [TODO: Add support for this field]

routingKey Buffer | Array <optional>

Partition key(s) to determine which coordinator should be used for the query. [TODO: Add support for this field]

routingNames Array <optional>

Array of the parameters names that are part of the partition key to determine the routing. Only valid for non-prepared requests, it's recommended that you use the prepare flag instead. [TODO: Add support for this field]

serialConsistency number <optional>

Serial consistency is the consistency level for the serial phase of conditional updates. This option will be ignored for anything else that a conditional update/insert. [TODO: Add support for this field]

timestamp number | Long <optional>

The default timestamp for the query in microseconds from the unix epoch (00:00:00, January 1st, 1970).

If provided, this will replace the server side assigned timestamp as default timestamp.

Use generateTimestamp() utility method to generate a valid timestamp based on a Date and microseconds parts.

traceQuery boolean <optional>

Enable query tracing for the execution. Use query tracing to diagnose performance problems related to query executions. Default: false.

To retrieve trace, you can call Metadata.getTrace() method.

Source:

ResultCallback(err, resultopt)

Callback used by execution methods.

Parameters:
Name Type Attributes Description
err Error

Error occurred in the execution of the query.

result ResultSet <optional>

Result of the execution of the query.

Source: