c1.execute('insert into db.weather values(\"'+stime.Format('yyyy-MM-dd HH:mm:ss.SSS')+'\",'+parseInt(Math.random()*100)+','+parseInt(Math.random()*300)+','+parseFloat(Math.random()*10+30)+',"Note");');
}
}catch(err){
conn.close();
throwerr;
}
// Now let's look at our newly inserted data
varretrievedData;
try{
c1.query('select * from db.weather limit 5 offset 100;',true).then(function(result){
//result.pretty();
console.log('=========>'+JSON.stringify(result));
// Neat!
});
}
catch(err){
conn.close();
throwerr;
}
// Let's try running some basic functions
try{
c1.query('select count(*), avg(temperature), max(temperature), min(temperature), stddev(temperature) from db.weather;',true)
.then(function(result){
result.pretty();
})
}
catch(err){
conn.close();
throwerr;
}
conn.close();
// Feel free to fork this repository or copy this code and start developing your own apps and backends with NodeJS and TDengine!