Registry / database / turing-mongo

turing-mongo

JSON →
library0.50.0jsnpmunverified

A promise-based MongoDB driver wrapper for Node.js, version 0.50.0. It simplifies MongoDB connections by returning a promise from setupConnection(). Designed as an internal microservice component for the otto-de/turing-microservice ecosystem, it relies on configuration via turing:mongo:host, turing:mongo:db, turing:mongo:user, and turing:mongo:password. No significant updates or release cadence visible; appears to be a stable but niche utility without broad community adoption or alternative differentiation.

npm install turing-mongo
INSTALL
IMPORT
SIG · TURING-MONGO
T
turing-mongo
databasejavascriptv0.50.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
const turingMongo = require('turing-mongo');
import turingMongo from 'turing-mongo';
Package does not ship ES modules; use CommonJS require().
setupConnection
const { setupConnection } = require('turing-mongo');
import { setupConnection } from 'turing-mongo';
setupConnection is a method on the default export, not a named export. Use require() and destructure from the result.
type imports
No TypeScript types provided.
Package does not include TypeScript declarations; use @types/mongodb or define own types.

Connects to MongoDB using turing-mongo with environment-based configuration, handling success and error via promises.

const turingMongo = require('turing-mongo'); // Optional: configure via environment or config module process.env['turing:mongo:host'] = process.env.MONGO_HOST || 'localhost'; process.env['turing:mongo:db'] = process.env.MONGO_DB || 'test'; turingMongo.setupConnection() .then(() => { console.log('Connected to MongoDB'); // Perform operations... const db = turingMongo.db; // if available }) .catch((error) => { console.error('Connection failed:', error); });
Debug
Known issues
gotchasetupConnection returns a promise but does not expose a way to access the native MongoDB driver instance directly.
fix
Use turingMongo.db or similar property after connection; if not available, consider using the mongodb driver directly.
affects: >=0.0.1
breakingVersion 0.50.0 is not stable; breaking changes may occur between minor versions.
fix
Pin to exact version and test upgrades carefully.
affects: >=0.0.1
deprecatedThe package uses a configuration style (turing:mongo:host) that is non-standard and may conflict with other libraries.
fix
Use environment variables or a dedicated config module to set these properties before calling setupConnection.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: turingMongo.setupConnection is not a function
Importing the package incorrectly, e.g., using ES module import syntax when the package is CommonJS.
fix
Use require('turing-mongo') instead of import.
MongoError: Authentication failed
Missing or incorrect turing:mongo:user or turing:mongo:password configuration.
fix
Set process.env['turing:mongo:user'] and process.env['turing:mongo:password'] before calling setupConnection.
ENOTFOUND localhost:27017
MongoDB host not reachable or not running.
fix
Ensure MongoDB is running and config turing:mongo:host points to the correct host.
Upgrade
Version history
0.50.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
18
Meta
1
OpenAI (training)
1
Resources
turing-mongo — npm install turing-mongo · libregistry