MongoDB

Sync your indexed and processed entities to a MongoDB Database

  1. Follow the instructions in the main page.

  2. Add the mongodb.uri secret to your cluster:

flair secret set -n mongodb.uri -v mongodb+srv://USERNAME:PASSWORD@HOST:PORT
  1. Change the connector to "mongodb" in the table configuration anywhere you have a "sink", i.e. in both streaming and batch .sql files:

CREATE TABLE sink_Swap (
    `entityId` STRING,
    `entityUpdatedAt` BIGINT,
    `chainId` INT,
    `contractAddress` STRING,
    `horizon` STRING,
    `blockNumber` BIGINT,
    `blockTimestamp` BIGINT,
    `forkIndex` INT,
    `transactionIndex` INT,
    `logIndex` INT,
    `localIndex` INT,
    `txHash` STRING,
    `txTo` STRING,
    `txFrom` STRING,
    `assetId` STRING,
    `resolver` STRING,
    PRIMARY KEY (`entityId`) NOT ENFORCED
) WITH (
    'connector' = 'mongodb',
    'uri' = '{{ secret("mongodb.uri") }}',
    'database' = 'MY_DB_NAME_HERE'
    'collection' = 'MY_COLLECTION_NAME_HERE',
    'write.batch-size' = '100',
    'write.flush.interval' = '60s'
);

Last updated