search

Home  >  Q&A  >  body text

Node.js+mongodb obtains data. Originally, one piece of data is every minute and I want to change it to one piece of data every five minutes. How to modify it?

db.getCollection("vocsdatas").aggregate([

{$match:{devname:{$regex:'North side of the park (Lvyi Substation)'}}},

{$group:{_id:"$sendtime",devname:{$max:"$devname"},qyname:{$max:"$qyname"},no:{$max:"$no" },no2:{$max:"$no2"},nox:{$max:"$nox"},nh3:{$max:"$nh3"},wendu:{$max:"$wendu"}, shidu:{$max:"$shidu"},fengsu:{$max:"$fengsu"},fengxiang:{$max:"$fengxiang"},ben:{$max:"$ben"},jiaben: {$max:"$jiaben"},yiben:{$max:"$yiben"},yiererjiaben:{$max:"$yiererjiaben"},jianduierjiaben:{$max:"$jianduierjiaben"},jiawan:{$ max:"$jiawan"},feijiawanzongting:{$max:"$feijiawanzongting"},so2:{$max:"$so2"},h2s:{$max:"$h2s"}}},

{$project:{_id:0,sendtime:"$_id",devname:1,qyname:1,no:1,no2:1,nox:1,nh3:1,wendu:1,shidu:1, fengsu:1,fengxiang:1,ben:1,jiaben:1,yiben:1,yiererjiaben:1,jianduierjiaben:1,jiawan:1,feijiawanzongting:1,so2:1,h2s:1}},

{$sort:{sendtime:-1}},

{$skip:20},

{$limit:10}

]

)


夏末~夏末~2042 days ago1056

reply all(0)I'll reply

No reply
  • Cancelreply