列 ID 的无效未设置值

Invalid unset value for column id

我想更新一条可能存在也可能不存在的记录。如果它不存在,那么什么也不会发生。


我正在为节点使用 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});

点赞table

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
)
  1. 更新您的问题定义以包含 question_id。
  2. 更新您的查询以包含标题参数 'update question set answer = ?, question_part = ?, tags = ?, title = ? where question_id = ?'