I have these three models:
Task.js
name: String
Question.js
score: Number,
task_id: { type: mongoose.Types.ObjectId, ref: 'Task', alias: 'task' },
problem_id: { type: mongoose.Types.ObjectId, ref: 'Problem', alias: 'problem' },
Problem.js
name: String
How can I count the number of tasks that matches a certain task name and has a question that is connected to a problem that matches a certain problem id?