When you are working with Mongoose in Node.js, you may have an issue that mongoose entity is not saved. For example;
wallet.tokens = tokens;
await wallet.save();
This happens element of entity is Mixed
type.
Mongoose is an idiot that cannot detect updates when element type is mixed.
So in this case, you can enforce updates by doing below.
wallet.markUpdated(‘tokens’);
await wallet.save();