You seem to understand that promises are wrong, re-read a few promises tutorials and this article .
As soon as you create a promise using new Promise(executor) , it is called immediately, so your whole function is executed as soon as you create them, and not when you bind them.
createUser should actually be a function that returns a promise, not the promise itself. createComment , createGame , createRoom too.
Then you can link them like this:
createUser() .then(createComment) .then(createGame) .then(createRoom)
The latest versions of mongoose return promises , if you do not go through callbacks, so you do not need to insert them into the function returns a promise.
source share