#Mongoose don't save data
15 messages · Page 1 of 1 (latest)
Ok. In general, you need to move the return and the .save outside of the for-loop unless you are 100% certain there is only one instance of wasUsed == false in your data. And even then, I'd probably do that differently. What do you return, if the condition isn't met? How did you get creatorData? I'm most interested in that last question to resolve your issue.
const creatorData = await this.accountModel.findOne({
email: hashedEmailCreator,
});
You need to more info?
Lastly, what does your entities look like? Account and TwoFactorBackup?
The classes defining Account and TwoFactorBackup....
Account schema interface?
If i print the saved it is to true
if i refresh database on mongodb compass don't appere change
@hybrid spade ?
It's hard to say what might be wrong with the info given. And, obviously we have a language barrier to cross too. 🤷🏻♂️
What info?
Exactly...