This question already has an answer here:
I am trying to find a solution on this
Json ---
{
"job": null,
"startedAt": ISODate("2017-01-14T14:17:48.889Z"),
"completion": 100,
"codeTestSubmissionId": "587a3831ce022b36580d63d7",
"deadlineAt": ISODate("2017-01-14T14:38:03.197Z")
}
I want to match two field deadlineAt and startedAt and then find the aggrigate for the fields
what I tried is this
{$project: {
// All your other fields here
cmp_value: {$subtract: ['$deadlineAt', '$startedAt)' ] }
}},
{ $match: { cmp_value: { $gte: 10*60*1000 } } },
{ $group: { _id: ticket.rating ? '$rating' : '$result', count: { $sum: 1 } } }
But getting error cant compare date with string Can anyone please help me on this. how can I compare and check if there is 10 min difference and then pass it to calculate aggregate?
Thanks in advance
via Rohit G
No comments:
Post a Comment