Registry / database / database-aggregator

database-aggregator

JSON →
library3.1.4jsnpmunverified

A database aggregator that collects data from various sources and stores them in a MongoDB database. It provides a built-in scheduler to launch synchronization and aggregation scripts as child processes, plus an HTTP API for read-only queries and process management. Current stable version is 3.1.4. The package requires manual configuration of scripts and environment variables. It ships TypeScript types and uses debug logging. Differentiators include its script-based extensibility and scheduler status tracking.

npm install database-aggregator
INSTALL
IMPORT
SIG · DATABASE-AGGREGATO
D
database-aggregator
databasejavascriptv3.1.4
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 databaseAggregator from 'database-aggregator'
const databaseAggregator = require('database-aggregator')
ESM-only; CommonJS require will fail.
Scheduler
import { Scheduler } from 'database-aggregator'
const { Scheduler } = require('database-aggregator')
Named export, ESM only. TypeScript types included.
HttpApi
import { HttpApi } from 'database-aggregator'
const HttpApi = require('database-aggregator').HttpApi
Named export, ESM only.

Starts the database aggregator scheduler and HTTP API with configurable MongoDB URL and home directory.

import { Scheduler, HttpApi } from 'database-aggregator'; import { createServer } from 'http'; const config = { mongoUrl: process.env.MONGO_URL ?? 'mongodb://localhost:27017', homeDir: process.env.DATABASE_AGGREGATOR_HOME_DIR ?? './config', }; const scheduler = new Scheduler(config); const api = new HttpApi({ scheduler, port: 3000 }); scheduler.start(); api.start(); createServer((req, res) => { res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ status: 'running' })); }).listen(8080); console.log('Aggregator started on port 8080');
Debug
Known issues
gotchaEnvironment variable DATABASE_AGGREGATOR_HOME_DIR must be set, otherwise the aggregator will fail to find configuration.
fix
Set DATABASE_AGGREGATOR_HOME_DIR to the directory containing configuration files.
affects: >=1.0.0
gotchaMongoDB must be running and accessible before starting the aggregator, as it stores status and logs in the database.
fix
Ensure MongoDB is running and the connection string is correct.
affects: >=1.0.0
gotchaThe package is ESM-only since v2; CommonJS require() will throw a Module parse error.
fix
Use import syntax or set type: 'module' in package.json.
affects: >=2.0.0
deprecatedPrevious versions used debug levels 'info' and 'verbose'; they are now replaced by 'warn' and 'error'.
fix
Update DEBUG environment variable to use 'debug', 'warn', or 'error' as documented.
affects: >=3.0.0
Errors
Common errors & fixes
Error: Cannot find module 'database-aggregator'
Package is not installed or not in node_modules.
fix
Run 'npm install -g database-aggregator' or add it to your project's dependencies.
SyntaxError: Cannot use import statement outside a module
Running ESM code without setting type: 'module' in package.json.
fix
Add 'type': 'module' to package.json or rename file to .mjs
TypeError: databaseAggregator is not a constructor
Using default import when the package exports named exports only.
fix
Use named import: import { Scheduler } from 'database-aggregator'
Error: connect ECONNREFUSED 127.0.0.1:27017
MongoDB is not running or not reachable at the specified host and port.
fix
Start MongoDB with 'docker start mongo' or update MONGO_URL environment variable.
Upgrade
Version history
3.1.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources
database-aggregator — npm install database-aggregator · libregistry