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
For AI agents: a documentation index is available at https://nodejs-rs-driver.docs.scylladb.com/main/llms.txt. A Markdown version of this page is at https://nodejs-rs-driver.docs.scylladb.com/main/api/metadata/Metadata.md.

Caution

You're viewing documentation for an unstable version of ScyllaDB Node.js Driver. Switch to the latest stable version.

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 219

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

getAggregate(keyspaceName, name, signature) → {Aggregate|null}

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 181

Returns:

The schema aggregate metadata, or null if it does not exist.

Type
Aggregate | null

getAggregates(keyspaceName, name) → {Array<Aggregate>}

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 170

Returns:

An array of schema aggregate metadata.

Type
Array<Aggregate>

getFunction(keyspaceName, name, signature) → {SchemaFunction|null}

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 160

Returns:

The schema function metadata, or null if it does not exist.

Type
SchemaFunction | null

getFunctions(keyspaceName, name) → {Array<SchemaFunction>}

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 149

Returns:

An array of schema function metadata.

Type
Array<SchemaFunction>

getKeyspace(name) → {KeyspaceMetadata|null}

Gets the keyspace metadata by name.

Parameters:
Name Type Description
name string

Name of the keyspace.

Source

metadata/index.js, line 59

Returns:

The keyspace metadata, or null if it does not exist.

Type
KeyspaceMetadata | null

getKeyspaces() → {Map<string, KeyspaceMetadata>}

Gets all keyspace metadata.

Source

metadata/index.js, line 67

Returns:

A map of all keyspaces indexed by name.

Type
Map<string, KeyspaceMetadata>

getMaterializedView(keyspaceName, name) → {MaterializedView|null}

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 195

Returns:

The materialized view definition, or null if it does not exist.

Type
MaterializedView | null

getReplicas(keyspaceName, token) → {Array<Host>}

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

Name of the keyspace.

token Buffer | Token | TokenRange

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

Source

metadata/index.js, line 80

Returns:

.

Type
Array<Host>

getTable(keyspaceName, name) → {TableMetadata|null}

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 139

Returns:

The table metadata, or null if it does not exist.

Type
TableMetadata | null

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 207

getUdt(keyspaceName, name) → {Udt|null}

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 129

Returns:

The UDT definition, or null if it does not exist.

Type
Udt | null

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

The token components.

Source

metadata/index.js, line 109

Returns:

constructed token from the input buffer.

Type
Token

newTokenRange(start, end) → {TokenRange}

Constructs a TokenRange from the given start and end tokens.

Parameters:
Name Type Description
start Token

The start token.

end Token

The end token.

Source

metadata/index.js, line 119

Returns:

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

Type
TokenRange

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
    • v0.6.1
  • Getting Started
  • Statements
    • Executing CQL Statements - Best Practices
    • Unprepared Statements
    • Batch Statements
    • Parameterized queries
  • Fetching Large Result Sets
  • Logging
  • Policies
    • Load Balancing
    • Retry Policies
  • Authentication
  • Shutdown
  • Migration Guide
  • API Reference
    • Modules
      • auth
        • AuthProvider
        • Authenticator
        • PlainTextAuthProvider
      • concurrent
      • datastax
        • graph
        • search
      • 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
        • Udt
        • UdtField
      • 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
        • BigDecimal
        • Duration
        • InetAddress
        • Integer
        • LocalDate
        • Long
        • ResultSet
        • ResultStream
        • Row
        • TimeUuid
        • Tuple
        • Uuid
        • Vector
    • Classes
      • AddressResolver
      • ByteOrderedToken
      • Client
      • ColumnInfo
      • DateRange
      • DateRangeBound
      • DseGssapiAuthProvider
      • DsePlainTextAuthProvider
      • Edge
      • Element
      • Encoder
      • EncoderMembers
      • ExecutionOptions
      • ExecutionProfile
      • FrameReader
      • GraphResultSet
      • HashSet
      • LineString
      • Murmur3Token
      • Path
      • Point
      • Polygon
      • Property
      • RandomToken
      • SslOptions
      • Token
      • TokenRange
      • Vertex
      • VertexProperty
    • 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 10 Aug 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.3