Mapper

The driver provides an object mapper that lets you interact with your data like you would interact with a set of documents.

Mapper Features

  • No / minimal configuration required: no need to specify the schema manually, it uses the driver schema metadata
  • Support denormalized schemas and materialized views: one model can be mapped to multiple tables
  • Convention-based mapping
  • Support bypassing query generation / bring your own queries and map results
  • Minimal performance impact compared to the core driver

Basic Usage

Retrieving objects from the database:

const videos = await videoMapper.find({ userId });
for (let video of videos) {
  console.log(video.name);
}

Updating an object from the database:

await videoMapper.update({ id, userId, name, addedDate, description });

Note that execution methods return a Promise, to simplify the code examples in the documentation async functions are used.

You can continue by reading the Getting Started Guide or other topics in the Mapper documentation: