我想更新可能存在或可能不存在的记录。如果它不存在则不会发生任何事情。
我正在使用cassandra驱动程序获取节点,收到错误
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): ResponseError: Invalid unset value for column question_id
尝试执行类似
的操作时let question = {
question_part: ['How many times has Leicester Tigers won the Heineken Cup?'],
answer: ['2'],
tags: ['competition', 'rugby'],
title: 'Rugby pub quiz'
};
let query = 'update question set answer = ?, question_part = ?, tags = ?, title = ? where question_id = ?';
const params = [question.answer, question.question_part, question.tags, question.title, question.question_id];
cassandraClient.execute(query, params, {prepare: true});
在像
这样的表格上CREATE TABLE question (
question_id timeuuid PRIMARY KEY,
answer list<text>,
cakes int,
created timestamp,
creator_display_name text,
creator_id text,
difficults int,
dislikes int,
drops int,
easies int,
favorites int,
impossibles int,
last_activity timestamp,
likes int,
question_part list<text>,
right_answers int,
tags set<text>,
title text,
views int,
wrong_answers int
)
答案 0 :(得分:0)