I am trying to update "has_signed" value to true but its not working note that my table model structure is like this:
export interface AdminOffersInterface {
//other fields
seller: [{
first_name: string,
last_name: string,
email: string,
role: string,
phone: String,
has_signed: boolean,
signature_id: string,
signature_req_id: string
}],
}
and I am using trying to update the value by using this function
async updateSellerSigningStatus(id: string): Promise<AdminOffersInterface> {
console.log("id.....", id);
try {
let response: any = await this.adminOffersModel.findOneAndUpdate(
{ _id: id },
{ $set: { "seller.$[elem].has_signed": true } },
{ new: true, arrayFilters: [{ "elem.has_signed": false }] }
);
const code = 200
response = {
code,
data: response
}
return response;
}
catch (error) {
console.log('error', error);
}
}