mysql - 节点红色错误 : Cannot create property '_msgid' on string

标签 mysql sql mqtt node-red mosquitto

我在 Node Red 中设置了这个: enter image description here

使用此 SQL(函数)代码:

msg.topic = "INSERT INTO temperature(temp, date) VALUES('" + 
msg.payload + "', 'NOW()')";

return msg.topic;

出现这个错误:

function : (error)
"TypeError: Cannot create property '_msgid' on string 'INSERT INTO 
temperature(temp, date) VALUES('1.23', 'NOW()')'"

我做错了什么?

最佳答案

你的函数只是返回一个字符串(msg.topic),它需要返回一个完整的对象。

msg.topic = "INSERT INTO temperature(temp, date) VALUES('" + msg.payload + "', 'NOW()')";

return msg;

关于mysql - 节点红色错误 : Cannot create property '_msgid' on string,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44118042/

相关文章:

sql - 使用 Azure SQL-db 安排 SQL 查询以将数据从一个表移动到另一个表

php - 在 mysql php 中查找讲师空闲时间

mysql - SQL 替换语句的正确 MariaDB 语法

ssl - Mosquitto - 内部和外部客户端配置

android: 为 mqtt 发布的消息设置 qos

mysql - 与 Rails 3 一起使用的最佳 MySQL 版本是什么?

mysql - 在 On 语句中使用 If 语句

php - 每 30 天范围内的列计数

java - Paho MQTT客户端仅使用密码时是否支持加密

mysql - Magento:为什么空表有重量?