Registry / database / node-red-contrib-mongodb3

node-red-contrib-mongodb3

JSON →
library2.0.1jsnpmunverified

A Node-RED node that provides an interface to MongoDB using the MongoDB 3.x native Node.js driver. Current stable version is 2.0.1, released in 2019. It supports CRUD operations, aggregation, and connection management via a URI string with optional authentication fields. Key differentiators: built specifically for Node-RED with a visual flow editor, supports parallelism limiting to avoid socket clogging, and allows direct access to db/collection objects. Based on the older node-red-contrib-mongodb2 but updated for driver 3.0. Low release cadence; not actively maintained.

npm install node-red-contrib-mongodb3
INSTALL
IMPORT
SIG · NODE-RED-CONTRIB-M
N
node-red-contrib-mongodb3
databasejavascriptv2.0.1
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.

mongodb3 node
✓ Install via Node-RED palette manager or npm: npm install node-red-contrib-mongodb3
This is a Node-RED node, not a standard JS module. It's used within Node-RED flows, not imported in code.

Demonstrates how to use the node in Node-RED: install, configure connection URI, set operation and payload.

// No code import necessary. Install the node in Node-RED and use it in flows. // Example: drag a mongodb3 node, configure URI (e.g., mongodb://localhost:27017/mydb), // set operation to 'find', payload to {name: "test"}, and deploy. // Result: msg.payload contains the query result.
Debug
Known issues
breakingVersion 2.0 changes: driver response props are now (correctly) added to message
fix
Update flows that rely on the exact property names in msg. Check docs for new response structure.
affects: 2.0.0
gotchaDo not enter credentials both in the URI and the Username & Password fields - this will create an invalid URI
fix
Use either the dedicated fields OR embed credentials in the URI, but not both.
affects: *
gotchaPassing a single parameter that is an array (e.g., for insertMany) must be wrapped in an outer array: msg.payload = [[...]]
fix
Wrap the array in another array: msg.payload = [[{_id: 1}, {_id: 2}]]
affects: *
gotchaParallelism limit controls concurrency; setting too high can clog sockets
fix
Set parallelism-limit to a reasonable number (e.g., 5-10) to avoid performance issues.
affects: *
gotchaUsing db/collection operations directly can cause disconnections; do not disconnect the shared instance
fix
Avoid calling disconnect() or close() on db/collection obtained from this node; let the node manage the connection.
affects: *
deprecatedMongoDB 3.x driver is deprecated; consider migrating to mongodb 4.x or later
fix
Upgrade to node-red-contrib-mongodb4 (if available) or use a different Node-RED MongoDB node that supports newer drivers.
affects: >=2.0.0
Errors
Common errors & fixes
Error: connect ECONNREFUSED 127.0.0.1:27017
MongoDB server not running or wrong host/port.
fix
Start MongoDB service or check the URI configuration.
MongoError: Authentication failed
Incorrect username/password, or authSource not specified.
fix
Verify credentials and add authSource parameter to URI, e.g., mongodb://user:pass@host:port/db?authSource=admin
TypeError: msg.payload is not iterable
For operations expecting an array (e.g., insertMany), payload must be an array inside an array.
fix
Set msg.payload = [[{ ... }]] instead of [{ ... }]
TypeError: Cannot read property 'collection' of undefined
Connection has not been established or the node is not configured with a valid database name in URI.
fix
Ensure URI includes a database path (e.g., mongodb://localhost:27017/mydb) and the node is deployed.
Upgrade
Version history
2.0.1latest on npm
Audit
Dependencies
mongodbrequiredMongoDB native driver v3.x is required for all database operations
node-redrequiredRequired as the runtime environment; the node is a Node-RED plugin
Agent activity
9 hits · last 30 days
node
8
Resources