ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
    • Supported Driver Versions
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Search Ask AI
ScyllaDB Docs ScyllaDB Node.js Driver API Reference Modules metadata Metadata

Metadata¶

metadata~Metadata(options, controlConnection)

Represents cluster and schema information. The metadata class acts as a internal state of the driver.

Constructor¶

new Metadata(options, controlConnection)

Creates a new instance of Metadata.

Parameters:
Name Type Description
options ClientOptions
controlConnection ControlConnection

Control connection used to retrieve information.

Source

metadata/index.js, line 45

Methods¶

checkSchemaAgreement() → {Boolean}

Checks whether hosts that are currently up agree on the schema definition.

This method performs a one-time check only, without any form of retry; therefore protocolOptions.maxSchemaAgreementWaitSeconds setting does not apply in this case.

Source

metadata/index.js, line 220

Returns:

true when all hosts agree on the schema and false when there is no agreement or when the check could not be performed (for example, if the control connection is down).

Type
Boolean

clearPrepared()

Clears the internal state related to the prepared statements. Following calls to the Client using the prepare flag will re-prepare the statements.

Source

metadata/index.js, line 127

getAggregate(keyspaceName, name, signature)

Gets a definition of CQL aggregate for a given name and signature.

Parameters:
Name Type Description
keyspaceName String

Name of the keyspace

name String

Name of the aggregate

signature Array:.<String:> | Array:.<{code:, info:}>

Array of types of the parameters.

Source

metadata/index.js, line 183

getAggregates(keyspaceName, name)

Gets the definition of CQL aggregate for a given name.

Parameters:
Name Type Description
keyspaceName String

Name of the keyspace

name String

Name of the aggregate

Source

metadata/index.js, line 173

getFunction(keyspaceName, name, signature)

Gets a definition of CQL function for a given name and signature.

Parameters:
Name Type Description
keyspaceName String

Name of the keyspace

name String

Name of the Function

signature Array:.<String:> | Array:.<{code:, info:}>

Array of types of the parameters.

Source

metadata/index.js, line 164

getFunctions(keyspaceName, name)

Gets the definition of CQL functions for a given name.

Parameters:
Name Type Description
keyspaceName String

Name of the keyspace.

name String

Name of the Function.

Source

metadata/index.js, line 154

getMaterializedView(keyspaceName, name)

Gets the definition of a CQL materialized view for a given name.

Note that, unlike the rest of the Metadata methods, this method does not cache the result for following calls, as the current version of the Cassandra native protocol does not support schema change events for materialized views. Each call to this method will produce one or more queries to the cluster.

Parameters:
Name Type Description
keyspaceName String

Name of the keyspace

name String

Name of the materialized view

Source

metadata/index.js, line 196

getReplicas(keyspaceName, token) → {Array}

Gets the host list representing the replicas that contain the given partition key, token or token range.

It uses the pre-loaded keyspace metadata to retrieve the replicas for a token for a given keyspace. When the keyspace metadata has not been loaded, it returns null.

Parameters:
Name Type Description
keyspaceName String
token Buffer | Token | TokenRange

Can be Buffer (serialized partition key), Token or TokenRange

Source

metadata/index.js, line 80

Returns:
Type
Array

getTable(keyspaceName, name)

Gets the definition of a table.

Parameters:
Name Type Description
keyspaceName String

Name of the keyspace.

name String

Name of the Table.

Source

metadata/index.js, line 145

getTokenRanges() → {Set:.<TokenRange:>}

Gets the token ranges that define data distribution in the ring.

Source

metadata/index.js, line 88

Returns:

The ranges of the ring or empty set if schema metadata is not enabled.

Type
Set:.<TokenRange:>

getTokenRangesForHost(keyspaceName, host) → {Set:.<TokenRange:>|null}

Gets the token ranges that are replicated on the given host, for the given keyspace.

Parameters:
Name Type Description
keyspaceName String

The name of the keyspace to get ranges for.

host Host

The host.

Source

metadata/index.js, line 99

Returns:

Ranges for the keyspace on this host or null if keyspace isn't found or hasn't been loaded.

Type
Set:.<TokenRange:> | null

getTrace(traceId, consistencyopt)

Gets the trace session generated by Cassandra when query tracing is enabled for the query. The trace itself is stored in Cassandra in the sessions and events table in the system_traces keyspace and can be retrieve manually using the trace identifier.

Parameters:
Name Type Attributes Description
traceId Uuid

Identifier of the trace session.

consistency Number <optional>

The consistency level to obtain the trace.

Source

metadata/index.js, line 208

getUdt(keyspaceName, name)

Gets the definition of an user-defined type.

Parameters:
Name Type Description
keyspaceName String

Name of the keyspace.

name String

Name of the UDT.

Source

metadata/index.js, line 136

newToken(components) → {Token}

Constructs a Token from the input buffer(s) or string input. If a string is passed in it is assumed this matches the token representation reported by cassandra.

Parameters:
Name Type Description
components Array:.<Buffer:> | Buffer | String

Source

metadata/index.js, line 109

Returns:

constructed token from the input buffer.

Type
Token

newTokenRange(start, end)

Constructs a TokenRange from the given start and end tokens.

Parameters:
Name Type Description
start Token
end Token

Source

metadata/index.js, line 119

Returns:

TokenRange build range spanning from start (exclusive) to end (inclusive).

refreshKeyspace(name)

Gets the keyspace metadata information and updates the internal state of the driver.

Parameters:
Name Type Description
name String

Name of the keyspace.

Source

metadata/index.js, line 58

refreshKeyspaces(waitReconnectopt)

Gets the metadata information of all the keyspaces and updates the internal state of the driver.

Parameters:
Name Type Attributes Description
waitReconnect Boolean <optional>

Determines if it should wait for reconnection in case the control connection is not connected at the moment. Default: true.

Source

metadata/index.js, line 67

Was this page helpful?

PREVIOUS
MaterializedView
NEXT
SchemaFunction
  • Create an issue
  • Edit this page

On this page

  • Metadata
    • Constructor
    • Methods
ScyllaDB Node.js Driver
Search Ask AI
  • main
    • main
  • API Reference
    • Modules
      • auth
        • AuthProvider
        • Authenticator
        • PlainTextAuthProvider
      • concurrent
      • datastax
      • errors
        • ArgumentError
        • AuthenticationError
        • BusyConnectionError
        • DriverInternalError
        • NoHostAvailableError
        • NotSupportedError
        • OperationTimedOutError
        • ResponseError
      • geometry
      • mapping
        • DefaultTableMappings
        • Mapper
        • ModelBatchItem
        • ModelMapper
        • Result
        • UnderscoreCqlToCamelCaseMappings
        • TableMappings
      • metadata
        • Aggregate
        • ClientState
        • ColumnMetadata
        • Index
        • KeyspaceMetadata
        • MaterializedView
        • Metadata
        • SchemaFunction
        • Strategy
        • TableMetadata
        • UdtField
        • UserDefinedType
      • metrics
        • DefaultMetrics
        • ClientMetrics
      • policies
        • addressResolution
          • AddressTranslator
          • EC2MultiRegionTranslator
          • MappingAddressTranslator
        • loadBalancing
          • AllowListPolicy
          • DCAwareRoundRobinPolicy
          • DefaultLoadBalancingPolicy
          • LegacyDefaultLoadBalancingPolicy
          • LoadBalancingConfig
          • LoadBalancingPolicy
          • RoundRobinPolicy
          • TokenAwarePolicy
        • reconnection
          • ConstantReconnectionPolicy
          • ExponentialReconnectionPolicy
          • ReconnectionPolicy
        • retry
          • FallthroughRetryPolicy
          • RetryPolicy
        • speculativeExecution
          • ConstantSpeculativeExecutionPolicy
          • NoSpeculativeExecutionPolicy
          • SpeculativeExecutionPolicy
        • timestampGeneration
          • MonotonicTimestampGenerator
          • TimestampGenerator
      • tracker
        • RequestLogger
        • RequestTracker
      • types
        • Duration
        • InetAddress
        • Integer
        • LocalDate
        • Long
        • ResultSet
        • ResultStream
        • Row
        • TimeUuid
        • Vector
    • Classes
      • AddressResolver
      • ByteOrderedToken
      • Client
      • Encoder
      • EncoderMembers
      • ExecutionOptions
      • ExecutionProfile
      • FrameReader
      • HashSet
      • Host
      • HostMap
      • LineString
      • Murmur3Token
      • Point
      • Polygon
      • PreparedInfo
      • RandomToken
      • SslOptions
      • Token
      • TokenRange
    • Interfaces
    • Events
    • Global Functions and Constants
Docs Tutorials University Contact Us About Us
© 2026 ScyllaDB | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 14 May 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.2