I have a program where tasks get done in "batches". The top-level view of my documents look like this:
{
_id: "xxx",
status: "done",
startedAt: 123456,
finishedAt: 789101112,
tasks: [...] // Huge array of deeply nested objects
}
Is it possible to construct a query for mongodb that returns only the length of the tasks array in this example?
Desired result:
{
_id: "xxx",
status: "done",
startedAt: 123456,
finishedAt: 789101112,
numTasks: 9999
}
Thank you in advance for any advice you can give.