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 mapping Mapper

Mapper¶

mapping~Mapper(client, optionsopt)

Represents an object mapper for Apache Cassandra and DataStax Enterprise.

Constructor¶

new Mapper(client, optionsopt)

Creates a new instance of Mapper.

Parameters:
Name Type Attributes Description
client Client

The Client instance to use to execute the queries and fetch the metadata.

options MappingOptions <optional>

The MappingOptions containing the information of the models and table mappings.

Source

mapping/mapper.js, line 44

Examples

Creating a Mapper instance with some options for the model 'User'

const mappingOptions = {
  models: {
    'User': {
      tables: ['users'],
      mappings: new UnderscoreCqlToCamelCaseMappings(),
      columnNames: {
        'userid': 'id'
      }
    }
  }
};
const mapper = new Mapper(client, mappingOptions);

Creating a Mapper instance with other possible options for a model

const mappingOptions = {
  models: {
    'Video': {
      tables: ['videos', 'user_videos', 'latest_videos', { name: 'my_videos_view', isView: true }],
      mappings: new UnderscoreCqlToCamelCaseMappings(),
      columnNames: {
        'videoid': 'id'
      },
      keyspace: 'ks1'
    }
  }
};
const mapper = new Mapper(client, mappingOptions);

Members¶

client :Client

The Client instance used to create this Mapper instance.

Type:
  • Client

Source

mapping/mapper.js, line 60

Methods¶

batch(items, executionOptionsopt) → {Promise:.<Result:>}

Executes a batch of queries represented in the items.

Parameters:
Name Type Attributes Description
items Array:.<ModelBatchItem:>
executionOptions Object | String <optional>

An object containing the options to be used for the requests execution or a string representing the name of the execution profile.

Properties
Name Type Attributes Default Description
executionProfile String <optional>

The name of the execution profile.

isIdempotent Boolean <optional>

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

The mapper uses the generated queries to determine the default value. When an UPDATE is generated with a counter column or appending/prepending to a list column, the execution is marked as not idempotent.

Additionally, the mapper uses the safest approach for queries with lightweight transactions (Compare and Set) by considering them as non-idempotent. Lightweight transactions at client level with transparent retries can break linearizability. If that is not an issue for your application, you can manually set this field to true.

logged Boolean <optional>
true

Determines whether the batch should be written to the batchlog.

timestamp Number | Long <optional>

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

Source

mapping/mapper.js, line 139

Returns:

A Promise that resolves to a Result.

Type
Promise:.<Result:>

forModel(name) → {ModelMapper}

Gets a ModelMapper that is able to map documents of a certain model into CQL rows.

Parameters:
Name Type Description
name String

The name to identify the model. Note that the name is case-sensitive.

Source

mapping/mapper.js, line 75

Returns:

A ModelMapper instance.

Type
ModelMapper

Was this page helpful?

PREVIOUS
DefaultTableMappings
NEXT
ModelBatchItem
  • Create an issue
  • Edit this page

On this page

  • Mapper
    • Constructor
    • Members
    • 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