Browse Source

add rest

master
zeus 4 years ago
parent
commit
5d83544e1c
  1. 9
      swarmlab-app/src/run/app.js

9
swarmlab-app/src/run/app.js

@ -395,12 +395,17 @@ cors(corsOptions), (req, res, next) => {
console.log(JSON.stringify('mongo connected')) console.log(JSON.stringify('mongo connected'))
var datestart = DateTime.fromObject(RES.start).toISODate() var datestart = DateTime.fromObject(RES.start).toISODate()
var dateend = DateTime.fromObject(RES.end).toISODate() var dateend = DateTime.fromObject(RES.end).toISODate()
if(datestart && dateend){
var search_term = { $and: [ { date: { $gt: datestart } }, { date: { $lt: dateend } } ] }; var search_term = { $and: [ { date: { $gt: datestart } }, { date: { $lt: dateend } } ] };
}else if(datestart){
var search_term = { $and: [ { date: { $gt: datestart } } ] };
}else if(dateend){
var search_term = { $and: [ { date: { $lt: dateend } } ] };
}
var resdataarray = [] var resdataarray = []
var resraw = {} var resraw = {}
var reslab = '' var reslab = ''
db.collection('logs').find({}, {}).toArray() db.collection('logs').find(search_term, {}).toArray()
.then(item => { .then(item => {
for (let i in item) { for (let i in item) {
reslab = item[i].tailed_path reslab = item[i].tailed_path

Loading…
Cancel
Save