I want to use a variable in a js script as below to retrieve lines processed at a certain date. I try to define "obj_start_date" and "obj_end_date" but i'm not able to use the value in the request ....
I've already tried to find a way in the forum but nothing work for me ... thanks in advance if you can help me :)
var result = 0;
var obj_start_date = {};
var start_date = "2016-01-04 00:00:00";
obj_start_date[start_date]=1;
var obj_end_date = {};
var end_date = "2016-01-04 23:59:59";
obj_end_date[end_date]=1;
var linkNames = db.lines.find({$and:[{'type':{$in:['mobile','voip']}},{'process_time':{$gte:obj_start_date}},{'process_time':{$lte:obj_end_date}}]}).map(function(doc){
result = result + parseFloat(doc.duration);
});
print( result+ "\r\n");
obj_end_date? I'm not 100% sure but I think you can do something like{'process_time':{$gte: start_date}},{'process_time':{$lte: end_date}}so instead of usingobj_start_date