node-red-contrib-orm-objection 1.0.0
A Node-RED node to use the Objection ORM to connect to a MySQL database.
node-red-contrib-orm-objection
Node-RED node to query a MySQL database with the Objection ORM.
Official repository: https://github.com/frederic-bonjour/node-red-contrib-orm-objection
Installation
- Install this Node from the Node-RED palette.
- Create a JS file that describes all your models (see Objection doc). This file must export an object with the model names as keys.
- In the
settings.js
file of your Node-RED installation, import this file in thefunctionGlobalContext
section :
functionGlobalContext: {
// os:require('os'),
objectionModels: require('./models')
},
(Of course, change the ./models
path to suit your needs.)
Finally, restart Node-RED.
Usage
- Insert a
storage/Objection ORM
into your Flow and configure the database connection. - Optionnaly select a Model name (or use
msg.topic
in the incoming message) - Optionnaly select the graph to be fetched along with the model (or use
msg.graph
in the incoming message)
The incoming message may contains the following properties:
where
: an object representing the WHERE clausebyId
: an integer or a String that will be used in thefindById()
method.