I am trying to store the output of a node-red-node-mysql mysql node into a flow Context variable to aid verification and debuging (I keep missing output in debug pane as they only occur every 10 minutes or so).
But all it writes to the flow context is a string "[object Object]".
The Change node contains:
(and I have also removed the msg.topic bit but same result.
I feed the same change node from a inject node where I have set payload, topic and others with the same objects I manage to capture from the mySQL node output, the flow contect variable is set correctly
So why sending the same data, but from a different node type give different results.
Inject node (yes I even duplicated some irrelevant fields)
Output of change Node for input from mySQL node
and same as an object
{
"payload": {
"fieldCount": 0,
"affectedRows": 0,
"insertId": 0,
"info": "(Rows matched: 0 Changed: 0 Warnings: 0",
"serverStatus": 2082,
"warningStatus": 0,
"changedRows": 0,
"topic": "UPDATE Parameters SET Parameter = 'House/hwTank/top/Temp' WHERE Parameter LIKE 'House_Tank';"
},
"parts": {
"id": "aac8ef27eebcad89",
"type": "array",
"count": 41,
"len": 1,
"index": 13
},
"_msgid": "4a9ae7cba3a26ee6",
"topic": "UPDATE Parameters SET Parameter = 'House/hwTank/top/Temp' WHERE Parameter LIKE 'House_Tank';",
"ttl": 0,
"_queuetimestamp": 1714320000216,
"_queueCount": 27
}
Output of change Node for input from inject node
Finally a snippet of the flow
[
{
"id": "138151cbcdb18b2d",
"type": "debug",
"z": "0b6335e33844cb2a",
"name": "debug 81",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1560,
"y": 240,
"wires": []
},
{
"id": "ee2a903078fd0ffa",
"type": "change",
"z": "0b6335e33844cb2a",
"name": "",
"rules": [
{
"t": "set",
"p": "LastDBrequest",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1200,
"y": 180,
"wires": [
[
"839d56c8c874dfcd",
"138151cbcdb18b2d"
]
]
},
{
"id": "3f92fb986016d19a",
"type": "inject",
"z": "0b6335e33844cb2a",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
},
{
"p": "parts",
"v": "{\"id\":\"aac8ef27eebcad89\",\"type\":\"array\",\"count\":41,\"len\":1,\"index\":13}",
"vt": "json"
},
{
"p": "ttl",
"v": "0",
"vt": "num"
},
{
"p": "_queuetimestamp",
"v": "1714320000216",
"vt": "num"
},
{
"p": "_queueCount",
"v": "27",
"vt": "num"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "UPDATE Parameters SET Parameter = 'House/PresPump/Current' WHERE Parameter LIKE 'HousePresPumpCurrent';",
"payload": "{\"fieldCount\":0,\"affectedRows\":2104477,\"insertId\":0,\"info\":\"4Rows matched: 2104477 Changed: 2104477 Warnings: 0\",\"serverStatus\":2082,\"warningStatus\":0,\"changedRows\":2104477}",
"payloadType": "json",
"x": 990,
"y": 120,
"wires": [
[
"ee2a903078fd0ffa"
]
]
},
{
"id": "44c09ce4be5151d8",
"type": "mysql",
"z": "0b6335e33844cb2a",
"mydb": "aa025dd27a4e9d87",
"name": "",
"x": 960,
"y": 280,
"wires": [
[
"ca1860475146d8f9",
"80e44054eedb2ac5"
]
]
},
{
"id": "ca1860475146d8f9",
"type": "junction",
"z": "0b6335e33844cb2a",
"x": 1100,
"y": 280,
"wires": [
[
"307afb51c6cc7dca",
"22397dbe0f9be484",
"ee2a903078fd0ffa"
]
]
},
{
"id": "307afb51c6cc7dca",
"type": "debug",
"z": "0b6335e33844cb2a",
"name": "debug 80",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1300,
"y": 440,
"wires": []
},
{
"id": "aa025dd27a4e9d87",
"type": "MySQLdatabase",
"name": "WombatHollow@ NAS",
"host": "10.0.0.118",
"port": "3306",
"db": "WombatControl",
"tz": "",
"charset": "UTF8"
}
]
Any idea as to why this anomaly
System Config data
NR 3.1.0 on a
Raspi 3B running Bullseye
npm v9.8.1
node v18.18.2