dateof(now())
を使用すると以下の挿入クエリが機能しません。しかし、new Date('2017-09-01 00:00:00+0000')
、これは動作しています。Node.jsでカサンドラの現在のタイムスタンプ
router.post('/recent_activities', function(req, res, next) {
var body = req.body;
console.log(body);
console.log(body.id + body.setid);
var query = "Insert into recent_activities
(id, setid, companyid, activity_name, activity_date, activity_by) values(? , ? , ? , ? , ? , ?)
"
client.execute(query, [body.id, body.setid, body.companyid, body.activity_name, dateof(now()), body.activity_by],
function(err, result) {
if (err) {
throw err;
} else {
console.log('success!');
}
});
res.json({ id: 201, message: 'All Success' });
});
500の内部サーバーエラーが発生しています。
は現在
ReferenceError: now is not defined
at /apps/node_cassandra/routes/index.js:96:85
at Layer.handle [as handle_request]
(/apps/node_cassandra/node_modules/express/lib/router/layer.js:95:5)
at next
(/apps/node_cassandra/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch
(/apps/node_cassandra/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request]
(/apps/node_cassandra/node_modules/express/lib/router/layer.js:95:5)
at /apps/node_cassandra/node_modules/express/lib/router/index.js:281:22