node-red-mongo-storage-plugin

0.1.2 • Public • Published

Node Red Mongo Storage Plugin

This plugin allows you to store your flows and library entries in MongoDB.

The plugin creates a collection per entity type and save each entity seperatly which lead to increased performance.

Getting Started

For this one, you'll need a separate script to start your Node Red, as per the guide for running a custom Node-Red inside your process:

http://nodered.org/docs/embedding.html

You can also check my example node-red-app in the github repository: node red quickstart with node-red-mongo-storage-plugin

Firstly, require the module:

npm install --save node-red-mongo-storage-plugin

Then, in your settings, add:

var settings = {
    ...
    storageModule : require("node-red-mongo-storage-plugin"),
    storageModuleOptions: {        
        mongoUrl: 'mongodb://localhost:27017',
        //also possible
        //mongoUrl: 'PROCESS.ENV.MONGOURL',
        database: 'local',
        //optional
        //set the collection name that the module would be using
        collectionNames:{
            flows: "nodered-flows",
            credentials: "nodered-credentials",
            settings: "nodered-settings",
            sessions: "nodered-sessions"
        }
    },
    ...
};

Your storageModuleOptions could also be injected with env variables

credit to: freefoote for creating the npm package node-red-flows-mongo which help me made this one.

TODO

1.Add tests 2.Create an abstraction over mongoHandler for reusing with different types of databases.

Readme

Keywords

Package Sidebar

Install

npm i node-red-mongo-storage-plugin

Weekly Downloads

8

Version

0.1.2

License

MIT

Unpacked Size

12.6 kB

Total Files

6

Last publish

Collaborators

  • adibenmatdev