Registry / database / betajs-mongodb

betajs-mongodb

JSON →
library1.0.24jsnpmunverified

BetaJS-MongoDB version 1.0.24 is a MongoDB wrapper designed to integrate with the BetaJS framework. It provides a simple abstraction for databases and tables, allowing CRUD operations and store-based access via BetaJS-Data. The package is stable but rarely updated, targeting Node.js 4.0 and later. It is not compatible with modern ESM or TypeScript without additional setup, and relies on BetaJS core and data modules.

npm install betajs-mongodb
INSTALL
IMPORT
SIG · BETAJS-MONGODB
B
betajs-mongodb
databasejavascriptv1.0.24
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.

MongoDatabase
var database = new BetaJS.Data.Databases.Mongo.MongoDatabase(url)
const { MongoDatabase } = require('betajs-mongodb')
Library adds classes to BetaJS namespace; no direct exports. Use require then access via BetaJS.Data.Databases.Mongo.MongoDatabase
DatabaseStore
var store = new BetaJS.Data.Stores.DatabaseStore(database, tableName)
const { DatabaseStore } = require('betajs-mongodb')
DatabaseStore is from betajs-data, not betajs-mongodb. Access via BetaJS namespace after require
BetaJS namespace
var BetaJS = require('betajs')
import BetaJS from 'betajs'
Library uses CJS only; ES import may not work. BetaJS must be required before child modules

Shows how to set up BetaJS-MongoDB with required dependencies and perform an insert operation.

var BetaJS = require('betajs'); require('betajs-data'); require('betajs-mongodb'); var database = new BetaJS.Data.Databases.Mongo.MongoDatabase('mongodb://localhost/database'); var table = database.getTable('my-table'); table.insertRow({ name: 'test' }).success(function(inserted) { console.log('Inserted:', inserted); }).error(function(err) { console.error('Error:', err); });
Debug
Known issues
gotchaRequires betajs and betajs-data to be required before betajs-mongodb
fix
Ensure require order: betajs, then betajs-data, then betajs-mongodb
affects: all
gotchaNo direct exports; all classes are attached to global BetaJS namespace
fix
Access via BetaJS.Data.Databases.Mongo.MongoDatabase, not via import or require.destructure
affects: all
deprecatedPackage uses .success()/.error() callback pattern instead of Promises
fix
Wrap calls in new Promise or use a Promise-aware wrapper; no native Promise support
affects: all
gotchaDatabaseStore is from betajs-data, not betajs-mongodb
fix
After requiring betajs-data, use BetaJS.Data.Stores.DatabaseStore
affects: all
gotchaMongoDatabase constructor expects full MongoDB connection string
fix
Pass a valid mongodb:// URI including database name, e.g., 'mongodb://localhost/mydb'
affects: all
Errors
Common errors & fixes
ReferenceError: BetaJS is not defined
betajs core module not required before child modules
fix
Ensure require('betajs') is called before require('betajs-mongodb')
TypeError: Cannot read property 'Mongo' of undefined
betajs-data not required or required after betajs-mongodb
fix
Add require('betajs-data') before require('betajs-mongodb')
TypeError: database.getTable is not a function
database not a valid MongoDatabase instance
fix
Instantiate with new BetaJS.Data.Databases.Mongo.MongoDatabase(uri)
Upgrade
Version history
1.0.24latest on npm
Audit
Dependencies
betajsrequiredCore BetaJS library required for all operations
betajs-datarequiredProvides Store abstraction and data handling
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
betajs-mongodb — npm install betajs-mongodb · libregistry