Registry / database / mongodb-rest

mongodb-rest

JSON →
library0.10.14jsnpmunverified

A REST API server for MongoDB using Node.js, Express, and the native MongoDB driver (version 0.10.14). Provides a simple, unsecured RESTful interface for rapid prototyping without building a backend. Offers CRUD operations via HTTP, optional token-based authentication (prototype), and configurable connection pooling. Maintained sporadically with limited security; explicitly not suitable for production use. Last updated in 2016, with no recent releases.

npm install mongodb-rest
INSTALL
IMPORT
SIG · MONGODB-REST
M
mongodb-rest
databasejavascriptv0.10.14
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.

startServer
const mongodbRest = require('mongodb-rest/server.js'); mongodbRest.startServer();
const startServer = require('mongodb-rest').startServer;
Import path is from '/server.js', not root index; no default export available.
startServer (with config)
const mongodbRest = require('mongodb-rest/server.js'); mongodbRest.startServer(config);
require('mongodb-rest')(config);
Config must be passed as argument to startServer, not as a constructor.
CLI command
npm install -g mongodb-rest && mongodb-rest
node mongodb-rest
CLI tool installed globally via npm; module is not executable directly.

Shows global installation, server start, and basic REST operations (insert, read) using curl commands.

// Install globally: npm install -g mongodb-rest // Ensure MongoDB is running on localhost:27017 // Start server: mongodb-rest // Insert a document via curl: // curl -d '{ "A1" : 201 }' -H "Content-Type: application/json" http://localhost:3000/test/example1 // Query all documents: // curl http://localhost:3000/test/example1 // Query with condition: // curl 'http://localhost:3000/test/example1?filter={"A1":201}'
Debug
Known issues
breakingNo security; do not expose to the internet
fix
Use only on localhost or in isolated development environments. Do not deploy in production.
affects: *
deprecatedUses Express 3.x and old MongoDB driver (v2.x) - not compatible with latest dependencies
fix
Consider migrating to a maintained alternative like 'restify' or 'keystone'.
affects: >=0.10
gotchaRequires global install for CLI; module export path is '/server.js'
fix
Use `require('mongodb-rest/server.js')` not `require('mongodb-rest')`.
affects: *
breakingAuthentication is prototype and may be removed/changed in future versions
fix
Do not rely on built-in auth; implement your own middleware if needed.
affects: >=0.9
Errors
Common errors & fixes
Error: Cannot find module 'mongodb-rest'
Module not installed or installed globally but not linked
fix
Install globally: npm install -g mongodb-rest. Or use local install: npm install mongodb-rest && require('./node_modules/mongodb-rest/server.js')
TypeError: object is not a function
Incorrect require path or using module as constructor
fix
Use const mRest = require('mongodb-rest/server.js'); mRest.startServer();
ECONNREFUSED - MongoDB not running
MongoDB service not started or wrong connection string
fix
Start MongoDB: mongod. Check config db string (default mongodb://localhost:27017).
Upgrade
Version history
0.10.14latest on npm
Audit
Dependencies
expressrequiredHTTP server framework
mongodbrequiredNative MongoDB driver for Node.js
Agent activity
8 hits · last 30 days
node
6
Resources
mongodb-rest — npm install mongodb-rest · libregistry