MongoDB Hydrator

Configuration

Example configuration in a processor:

{
  "name" : "MongoDB Hydrator",
  "active" : true,
  "type" : "mongo-hydrator",
  "servers": [
    {
      "host": "localhost",
      "port": 8080
    }
  ],
  "url": "mongo+srv://cluster0.qwerty.mongodb.net/myDatabase.myCollection",
  "tls": false,
  "db": "database_name",
  "collection": "collection_name",
  "transactions": false,
  "strict": false,
  "multiDocumentPath": "/arrayField",
  "multiDocumentKeepSiblings": false,
  "multiDocumentCleanup": true

}

Configuration parameters:

servers.host

(Required*, String) The host(s) where the instance of the MongoDB is located

servers.port

(Required*, Integer) The port(s) on which MongoDB is running

url

(Required*, String) A MongoDB connection url, optionally containing the database and collection names.

* Only one connection method (either servers or url is required. If both are given, the url takes precedence)

tls

(Optional, Boolean) Whether tls should be enabled. Defaults to false unless a Mongo Atlas url (mongo+srv://) is used in which case the default is true

db

(Required*, String) The name of the MongoDB database to hydrate to

collection

(Required*, String) The name of the MongoDB collection to hydrate to

* The database name (db) and collection name (collection) need not be explicitly defined if they are included in the url parameter

transactions

(Optional, Boolean) Whether details of the transactions (database name, collection, identifier and action) should be written to a separate collection. Defaults to false

strict

(Optional, Boolean) Whether to strictly enforce inserts and updates (and fail in the case an inserted id already exists, or an updated id doesn't already exist) or to use upserts (where an insert of an existing id or an update to a non-existent id will succeed). Defaults to false

multiDocumentPath

(Optional, String) Path to an array field in the record that will be used to generate multiple documents, each value in the array will be written to MongoDB as a new document. If the field isn't found, or it's not an array the record will be ignored.

multiDocumentKeepSiblings

(Optional, Boolean) Whether to keep the same document structure. If it's set to false the document will just keep the field being used for the multi document hydration. Defaults to false

multiDocumentCleanup

(Optional, Boolean) Whether to perform a cleanup for documents that were not hydrated in the current execution, applies only to multi-document hydration. Defaults to true

©2024 Pureinsights Technology Corporation