S
S
squadbrodyaga2020-11-15 18:08:03
Node.js
squadbrodyaga, 2020-11-15 18:08:03

How to wait for save to database?

Hello.
How to make the code continue to work only after the data has been saved to the database?

await Bet.findByIdAndUpdate(bet.id, {
  player2: session.user 
})
...чтобы этот код не выполнялся пока findByIdAndUpdate всё не сохранит?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2020-11-15
@squadbrodyaga

In your example it will. It is obvious that you provided little information.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question