Registry / database / flexmonster-mongo-connector

flexmonster-mongo-connector

JSON →
library2.9.130jsnpmunverified

Flexmonster MongoDB Connector is a server-side Node.js tool that retrieves data from MongoDB databases for use with Flexmonster Pivot Table & Charts. Version 2.9.130 is current, with stable release cadence. It bridges MongoDB collections to Flexmonster's pivot grid, enabling ad-hoc analytics, reporting, and business intelligence without writing ETL pipelines. Key differentiator: seamless integration with Flexmonster's front-end component, supporting complex aggregation pipelines, real-time data refresh, and type-safe TypeScript definitions. Requires mongodb driver ^4.17.0 (4.17.2 or earlier). Unlike generic ODBC/JDBC connectors, this is purpose-built for Flexmonster, offering optimized query translation and native MongoDB aggregation support.

npm install flexmonster-mongo-connector
INSTALL
IMPORT
SIG · FLEXMONSTER-MONGO-
F
flexmonster-mongo-connector
databasejavascriptv2.9.130
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.

FlexmonsterMongoConnector
import { FlexmonsterMongoConnector } from 'flexmonster-mongo-connector'
const FlexmonsterMongoConnector = require('flexmonster-mongo-connector')
ESM-only since v2.9. Use named import. CommonJS require will fail.
FMConnectorConfig
import type { FMConnectorConfig } from 'flexmonster-mongo-connector'
import { FMConnectorConfig } from 'flexmonster-mongo-connector'
FMConnectorConfig is a TypeScript interface; use type import to avoid runtime inclusion.
default
import FlexmonsterMongoConnector from 'flexmonster-mongo-connector'
import { FlexmonsterMongoConnector } from 'flexmonster-mongo-connector'
Default export is the same class but named import is preferred and recommended.

Demonstrates connecting to a MongoDB collection and fetching data for Flexmonster pivot table using FlexmonsterMongoConnector with TypeScript.

import { FlexmonsterMongoConnector } from 'flexmonster-mongo-connector'; import { MongoClient } from 'mongodb'; async function main() { const uri = process.env.MONGO_URI ?? 'mongodb://localhost:27017'; const client = new MongoClient(uri); await client.connect(); const db = client.db('mydb'); const connector = new FlexmonsterMongoConnector(); await connector.connect({ db, collection: 'sales', report: { measures: [{ uniqueName: 'revenue', aggregation: 'sum' }] } }); const data = await connector.getData(); console.log(data); await client.close(); } main().catch(console.error);
Debug
Known issues
breakingRequires MongoDB driver version 4.17.2 or earlier; newer versions (5.x) are incompatible.
fix
Pin mongodb dependency to ^4.17.0 in your package.json.
affects: >=2.0.0
breakingESM-only since v2.9.0; CommonJS require() will throw ERR_REQUIRE_ESM.
fix
Use ESM imports (import { FlexmonsterMongoConnector } from 'flexmonster-mongo-connector') or use dynamic import() in CJS projects.
affects: >=2.9.0
gotchaConnector expects a MongoDB Db instance, not a MongoClient. Passing a client object will cause connection failures at runtime.
fix
Call db from client before passing: client.db('databaseName').
affects: >=2.0.0
deprecatedThe constructor option 'uri' is deprecated in favor of passing a pre-initialized 'db' object and report config.
fix
Use the 'connect' method with 'db' and 'report' options instead of passing 'uri' to the constructor.
affects: >=2.9.0
Errors
Common errors & fixes
Error: The module "./node_modules/flexmonster-mongo-connector/build/index.js" was resolved, but the "exports" field does not include it.
Using an older version of Node.js (<12) or incorrect import path due to ESM setup.
fix
Upgrade Node.js to >=14 and use ESM imports as shown in the quickstart.
TypeError: client.db is not a function
Passing MongoClient instead of Db object to connector.
fix
Instantiate Db: const db = client.db('myDatabase'); then pass db to connector.
MongoServerError: unknown operator: $sum
Using '$sum' aggregation directly within report; connector expects specific measure definitions.
fix
Define measures with 'aggregation: "sum"' (string) instead of using MongoDB aggregation pipeline syntax.
Upgrade
Version history
2.9.130latest on npm
Audit
Dependencies
mongodbrequiredRequired for MongoDB driver operations; only version 4.17.0 - 4.17.2 supported.
Agent activity
25 hits · last 30 days
node
24
OpenAI (training)
1
Resources
flexmonster-mongo-connector — npm install flexmonster-mongo-connector · libregistry