MongoDB

Publish JSON based events to the mature standard document storePublishes JSON-based events to MongoDB, a widely-used document store

Overview

Document database support is provided using the MongoDB Publisher Transport. Processed events are published to a specified MongoDB database collection.

The events are serialised using a document formatter serialiser or a custom transformer implementation.

This transport is designed to facilitate efficient data publishing into MongoDB with customisable serialisation options.

Some key features are:

  1. MongoDB integration Sends processed events to a defined MongoDB collection.

  2. Serialiser options Uses a default Document Formatter serialiser or allows custom serialisation.

Examples & DSL attributes

This example sets up the MongoDB Publisher Transport to send events to a local MongoDB instance (localhost:27017).

It stores data in the customerdb database and emea_customers collection, using ordered inserts.

Authentication is done with the joule user and SCRAM-SHA-1 mechanism. Events are serialised individually (not in batches) with Base64 encoding and application/octet-stream content type. SSL is disabled.

mongodbPublisher:
  servers:
    localhost: 27017
  enable ssl: false

  database: customerdb
  collection: emea_customers
  ordered inserts: true

  credentials:
    user: joule
    password: password
    mechanism: SCRAM_SHA_1

  serializer:
    batch: false
    formatter:
      documentFormatter:
        contentType: application/octet-stream
        encoding: base64

Attributes schema

Credential attributes schema

Serialisation attributes schema

This topic provides configuration parameters available object serialisation process.

Serialiser example

The configuration below will serialise StreamEvents as MongoDB documents.

mongodbPublisher:
  ...

  serializer:
    batch: false
    formatter:
      documentFormatter:
        contentType: application/octet-stream
        encoding: base64

Document formatter

The document formatter in Joule is a built-in tool that converts StreamEvents into MongoDB's Document type.

This allows the processed events to be formatted correctly before being inserted into a MongoDB collection. The formatter ensures that the data is serialised in a way that MongoDB can understand and store efficiently.

Additional resources

Last updated