How to Update populated feilds in MOngoDB using Mongoose

34 views Asked by At

Let Say i am populating Contestants with their respective Wallets like this

let contestant = await User.findById(playerId).populate({
      path: "Wallet",
    });

Now I am updating the wallet cash like this

 contestant.Wallet.cash -= Matchcontest.joiningfee;
await contestant.save()

after doing this the Wallet cash is not updating in MongoDB am i doing something wrong or we cannot update the populated values

I tried doing the code above but not able to solve it

0

There are 0 answers