Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 无法在Postgresql的数组中插入JSON对象_Node.js_Postgresql_Express_Backend - Fatal编程技术网

Node.js 无法在Postgresql的数组中插入JSON对象

Node.js 无法在Postgresql的数组中插入JSON对象,node.js,postgresql,express,backend,Node.js,Postgresql,Express,Backend,我试图在数组中插入json对象,但出现以下错误:- [这是错误] 还有一个小消息,我已经尝试了stackoverflow上给出的几乎所有方法,但仍然无法解决它尝试用}替换“{with\'{,同样地}”\'另外,您在insert语句中提到了两列,您正在传递4个值。user_tweets是一个数组,我想插入一个有3个值的json对象\@BjarniRagnarsson我尝试了您的方法,但我得到了以下错误:-数组文字格式错误:“{”tweet_uid:$2,“tweet_内容”:$3,“type_of

我试图在数组中插入json对象,但出现以下错误:- [这是错误]


还有一个小消息,我已经尝试了stackoverflow上给出的几乎所有方法,但仍然无法解决它

尝试用}替换“{with\'{,同样地}”\'另外,您在insert语句中提到了两列,您正在传递4个值。user_tweets是一个数组,我想插入一个有3个值的json对象\@BjarniRagnarsson我尝试了您的方法,但我得到了以下错误:-数组文字格式错误:“{”tweet_uid:$2,“tweet_内容”:$3,“type_of”:$4}”。这肯定是一个格式不正确的数组。奇怪的是没有看到变化。要使其成为合法数组,需要将其包含在“”中,而不是“”中。抱歉-我没有尝试此功能的设置。
userPool.query('INSERT INTO tweets(tweet_user_id , user_tweets) VALUES($1 , "{"tweet_uid": $2 , "tweet_content": $3 ,"type_of": $4 }")' , [user_uid , tweet_id , content , 'by_user'  ]