Here's sample records of my_task collection, when the task status is changed, there will be a record added into the status_changed_utc field with the status code and time, status 6 stands for the task has been completed; there's also requested_completion_utc field on the top level indicates what is the expected completion time of the task, so how do I find out the records with actual completion time that is later than the requested_completion_utc, for the tasks created in this month? pls note that requested_completion_utc and the status_changed_utc with status 6 both may not exist in the record.
sample records:
{
"_id" : ObjectId("5ce726ae92e2247db561a2f2"),
"created_utc" : ISODate("2019-05-23T23:03:10.000+0000"),
"requested_completion_utc" : ISODate("2019-05-23T00:00:00.000+0000"),
"status_changed_utc" : [
{
"status" : NumberInt(1),
"time" : ISODate("2019-05-23T23:03:10.000+0000")
},
{
"status" : NumberInt(2),
"time" : ISODate("2019-05-23T23:05:03.000+0000")
},
{
"status" : NumberInt(4),
"time" : ISODate("2019-05-23T23:05:06.000+0000")
},
{
"status" : NumberInt(5),
"time" : ISODate("2019-05-23T23:05:07.000+0000")
},
{
"status" : NumberInt(6),
"time" : ISODate("2019-05-23T23:05:09.000+0000")
}
]
},
{
"_id" : ObjectId("5ce726ae92e2247db561a232"),
"created_utc" : ISODate("2019-05-23T23:03:10.000+0000"),
"status_changed_utc" : [
{
"status" : NumberInt(1),
"time" : ISODate("2019-05-23T23:03:10.000+0000")
}
]
},
{
"_id" : ObjectId("5ce726ae92e2247db561a231"),
"created_utc" : ISODate("2019-09-23T21:03:10.000+0000"),
"requested_completion_utc" : ISODate("2019-09-21T00:00:00.000+0000"),
"status_changed_utc" : [
{
"status" : NumberInt(1),
"time" : ISODate("2019-09-23T23:03:10.000+0000")
}
]
}