Registry / database / integreat-transporter-mongodb

integreat-transporter-mongodb

JSON →
library1.3.0jsnpmunverified

A MongoDB transporter for the Integreat data integration hub, enabling reading from and writing to MongoDB collections. Current stable version is 1.3.0, released with no active release cadence indicated. It acts as a bridge between Integreat pipelines and MongoDB, supporting operations like get, set, delete, and streaming via change streams. Key differentiators: tightly coupled with Integreat's JSON-based action format, supports MongoDB aggregation pipelines for data transformation, and uses a single collection per transporter instance. Designed for Node.js 18.18+ with ESM support.

npm install integreat-transporter-mongodb
INSTALL
IMPORT
SIG · INTEGREAT-TRANSPOR
I
integreat-transporter-mongodb
databasejavascriptv1.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import transporter from 'integreat-transporter-mongodb'
const transporter = require('integreat-transporter-mongodb')
ESM-only package; CommonJS require() will fail.
TransporterMongodb
import TransporterMongodb from 'integreat-transporter-mongodb'
import { TransporterMongodb } from 'integreat-transporter-mongodb'
The package exports a default class; named import is incorrect.
type TransporterOptions
import type { TransporterOptions } from 'integreat-transporter-mongodb'
TypeScript type exported as named export; valid for type-only imports.

Sets up Integreat with MongoDB transporter, inserts a document, and retrieves it.

import integrert from 'integreat'; import transporter from 'integreat-transporter-mongodb'; const great = integrert({ transporters: [ transporter({ uri: process.env.MONGODB_URI ?? 'mongodb://localhost:27017', db: 'mydb', collection: 'mycollection' }) ] }); await great.transport({ type: 'set', payload: { id: '123', data: { name: 'Alice' } } }); const result = await great.transport({ type: 'get', payload: { id: '123' } }); console.log(result.data); // { id: '123', name: 'Alice' }
Debug
Known issues
gotchaThe transporter uses a single MongoDB collection per instance; you must create separate transporter instances for different collections.
fix
Instantiate multiple transporters with different collection names.
affects: >0
breakingVersion 1.0.0 dropped support for Node.js <18.18 and switched to ESM-only exports.
fix
Upgrade Node.js to >=18.18 and use ESM imports (import/export).
affects: >=1.0.0
gotchaThe transporter expects actions in Integreat's JSON format; providing raw MongoDB queries may cause unexpected behavior.
fix
Always wrap MongoDB operations in Integreat action objects with type (get, set, delete).
affects: >0
deprecatedOption 'connString' used in v0.x was renamed to 'uri' in v1.0.0.
fix
Use 'uri' instead of 'connString' in transporter options.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/integreat-transporter-mongodb/lib/index.js from /path/to/index.js not supported.
Package is ESM-only and cannot be used with require() in CommonJS projects.
fix
Switch to ESM imports or use dynamic import().
TypeError: transporter is not a function
Importing the default export incorrectly, e.g., using destructuring.
fix
Use `import transporter from 'integreat-transporter-mongodb'` (no braces).
MongoDB error: MongoNotConnectedError: Client must be connected before running operations
MongoDB connection not established before first operation.
fix
Ensure the Integreat instance is started by calling `await great.start()` after setup.
TypeError: Missing required parameter 'collection' in transporter options
The 'collection' option is mandatory but was omitted.
fix
Include `collection: 'yourCollectionName'` in transporter options.
Upgrade
Version history
1.3.0latest on npm
Audit
Dependencies
mongodbrequiredMongoDB driver for database interactions
integreatrequiredPeer dependency for Integreat pipeline integration
Agent activity
4 hits · last 30 days
node
4
Resources
integreat-transporter-mongodb — npm install integreat-transporter-mongodb · libregistry