I have to display the message from start date to end date ..Once end date is over ,message should disable..I have tried to match but am not getting the values..Kindly help me in this issue..Thanks in Advance
mongo.notification.find({'clienttoken' : req.body.clienttoken},function(err,response){
if (err) throw err
console.log(response)
console.log("get Request from Client")
mongo.user.aggregate([
{
$lookup:{
from:"notifications",
localField:"_id",
foreignField:"user_id",
as:"PersonName"
}
},
{
$match: {'clienttoken' : req.body.clienttoken , 'end_date': { $gt: 'start_date', $lt: 'end_date'}
}
},
{
$unwind:'$PersonName'
},
{
"$project":{
"username":"$username",
"fname":"$fname",
"userid":"$_id",
"email":"$email",
"clienttoken" : "$clienttoken",
"message":"$PersonName.message",
"end_date" : "$PersonName.end_date",
"start_date": "$PersonName.start_date"
}
}
]).exec(function(err, clientmsg){
if (err) throw err;
res.json(clientmsg)
});
});