I want to update application_status by job_id and applicant_id but I get the following error:
MongoServerError: Plan executor error during findAndModify :: caused by :: The positional operator did not find the match needed from the query.
this is my code to findByIdAndUpdate
this.jobModel.findByIdAndUpdate(
{
_id: input.job_id,
applicants: { $elemMatch: { applicant_id: input.applicant_id } },
},
{ $set: { "applicants.$.application_status": input.application_status } },
{ new: true },
);
this is my database model
thanks for help!!