1
是否可以每隔x秒刷新一次帕格變量? 我有以下代碼:每x秒刷新帕格變量值
router.get("/rooms", function(req, res) {
device_data.find({
"selector": {
"payload.d.data": {
"$gte": 0
}
},
"fields": [
"_id",
"deviceId",
"payload.d.data",
"payload.d.time"
],
"sort": [{
"payload.d.time": "desc"
}]
}, function(err, device) {
if (err) {
throw err;
} else {
res.render(path + 'rooms', {
rooms: rooms,
});
});
我tryed device_data.find之前使用的setInterval但它不工作。