【发布时间】:2015-02-05 06:08:07
【问题描述】:
我正在尝试更新“地图”列,但尝试这样做会导致错误:
错误:
error: database errorTypeError: Not a valid bigint, expected Long/Number/Buffer, obtained '2014-12-07T13:53:10.658Z'
尝试
var query_attendance = 'UPDATE emp_attendance SET attendace = attendace + ? where year = ? and month = ? and emp_id = ?';
var udpateAttendance = function(empId, timestampMillis, cb){
var foundDate = new Date(timestampMillis);
var year = foundDate.getUTCFullYear();
var month = foundDate.getUTCMonth();
var date = foundDate.getUTCDate();
var attendace = {};
attendace['2014-12-07T13:53:10.658Z'] = 'Present';
// winston.info('attendace' + JSON.stringify(foundDate));
var values = [attendace, year, month, empId];
var options = {
hints: ['map','int','int','int'],
prepare: true
};
winston.info('Values: ' + JSON.stringify(values));
client.execute(query_attendance, values, options, function(err, resultSet){
winston.info('Query Completed');
if(err){
winston.error('database error' + err);
cb(err, null);
return;
}
winston.info('Query successful');
cb(null, resultSet);
});
}
我的观点:
我想我需要告诉驱动程序地图集合中的键类型是时间戳类型,但我没有找到如何为驱动程序指定此类输入。
【问题讨论】:
标签: javascript node.js cassandra nosql