Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/399.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
Javascript 函数lambda,用于在Apache Cassandra中从JSON文档写入数据_Javascript_Node.js_Cassandra_Aws Lambda_Async.js - Fatal编程技术网

Javascript 函数lambda,用于在Apache Cassandra中从JSON文档写入数据

Javascript 函数lambda,用于在Apache Cassandra中从JSON文档写入数据,javascript,node.js,cassandra,aws-lambda,async.js,Javascript,Node.js,Cassandra,Aws Lambda,Async.js,我在Node.js中有一个lambda函数,它允许我写入Apache Cassandra数据库 我通过检索字段从JSON文档事件生成查询 在Cassandra中,如果列不存在,则不可能生成alter表。所以我为所有列创建了一个alter表,忽略了这个错误,第一次对JSON元素进行了insert 当我想修改JSON并添加字段时,问题就出现了 问题是,我只能在表中插入我添加的JSON文档的最后一个元素。例如: { “哈密特”:18.75, “温度”:14.45, }虽然此代码可以回答问题,但提供

我在Node.js中有一个lambda函数,它允许我写入Apache Cassandra数据库

我通过检索字段从JSON文档事件生成查询

在Cassandra中,如果列不存在,则不可能生成alter表。所以我为所有列创建了一个alter表,忽略了这个错误,第一次对JSON元素进行了insert

当我想修改JSON并添加字段时,问题就出现了

问题是,我只能在表中插入我添加的JSON文档的最后一个元素。例如:

{
“哈密特”:18.75,
“温度”:14.45,

}
虽然此代码可以回答问题,但提供有关如何和/或为什么解决问题的附加上下文将提高答案的长期价值。
const query = 'INSERT INTO my_table (nom_entreprise, date_serveur, other_column)' + 
  ' VALUES (?, ?, ?)';
client.execute(query, [ name, new Date(), otherField ], { prepare: true }, callback);