Node-RED Storage API

841 views
Skip to first unread message

Nicholas O'Leary

unread,
Apr 11, 2015, 8:52:45 AM4/11/15
to Node-RED Mailing LIst

We seem to have had a lot of questions recently regarding the storage API, to which I find myself repeating the same response a lot.

Here is a definitive response to which I will link anyone who asks about it - only if their question is not directly answered here will I give any more of a response - for example, if there is a specific question about a specific point of implementation.

The storage API is documented here: http://nodered.org/docs/api/storage/index.html

We have a CouchDB implementation and a MongoDB implementation in the node-red-bluemix repository on GitHub. They are both slightly out of date - the MongoDB one more so.
But they should provide starting points to anyone wanting to use these databases behind Node-RED.

We will be publishing the mongo and couchdb storage plugins, once they are updated and properly tested, to their own repositories on github. Can't say when exactly that will happen.

Nick

Ted Barnett

unread,
May 13, 2016, 11:12:47 PM5/13/16
to Node-RED
Perhaps I am missing something, but the Storage API documentation does not make clear how one actually sets up the default database as the "Storage" object (under Bluemix).   Ideally there would be an example flow (or function) that demonstrates the use of the Storage API for each of the methods.  
 
In my case, I am trying to use the Storage API to maintain a set of session variables.  I do have the proper 'storageModule: require("./couchstorage")' in my bluemix-settings.js file, but when I include any reference to "Storage" in my functions (e.g. Storage.getSessions()), I get an error ("Storage is not defined").  I've searched high and low (this forum, the flow library, stackexchange, etc.) for any working example of the use of the Storage API in a working function or flow, but to no avail.  I'm sure it's an obvious configuration or initialization problem, but I can't find the right incantation.  
 
I'm afraid the problem is that Node-RED appears simple enough to empower newbies like myself, but still requires detailed examples for us to make it work.

Nicholas O'Leary

unread,
May 14, 2016, 6:48:40 PM5/14/16
to Node-RED Mailing List
Hi Ted,

the storage api is not there for you to use in your flows. It is the mechanism through which the Node-RED runtime stores all of its data.

The API is documented to enable new storage plugins to be written for alternative backends - such as the cloudant one used in Bluemix.

This is why you've not found any docs or examples showing how to use it in the way you're asking :)

Nick





--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages