[{"id":"640d9219.284b4c","type":"DataIn","z":"2499aa94.c14866","collection":"2e31cc75.f3a864","name":"Backup to DB","update":false,"path":"/","x":660,"y":400,"wires":[]},{"id":"d284a4b4.19fa38","type":"inject","z":"2499aa94.c14866","name":"Every 2 hours","topic":"","payload":"","payloadType":"date","repeat":"7200","crontab":"","once":false,"x":160,"y":400,"wires":[["cef9cc4.6793b3"]]},{"id":"cef9cc4.6793b3","type":"function","z":"2499aa94.c14866","name":"Save globals to jsonDB","func":"var d = new Date();\nvar options = { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric' };\nvar stamp = d.toLocaleDateString(\"en-GB\", options) + \" \" + d.toLocaleTimeString(\"en-GB\");\nglobal.set(\"lastSaved\", stamp);\nglobal.set(\"lastSavedReason\", msg.topic == \"System Settings Changed\" ? \"System Settings Changed\" : \"Timed Backup\");\nmsg.payload = context.global; //or just global\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":400,"wires":[["640d9219.284b4c"]]},{"id":"2e31cc75.f3a864","type":"json-db-collection","z":"","name":"chSystem","collection":"chSystem","save":true}]
In NR 0.17.5, the above flow, the code msg.payload = context.global;
in function "Save globals to jsonDB" dumps all objects in context.global to json-db-node-red and thence to disk for manual/timed backups. It's been working fine for 3 years.
In NR 1.0.3 the same code just produces output containing the global functions get, set and keys.
What is the simplest way of fixing this please? Do I now need to enumerate every object in global perhaps? (I'm keen to keep code/node changes to the bare minimum as this idiom is used in many other places.)
Many thanks for any pointers.