Updating multiple collections
I really think your code is having at least two issues. The first one is something that may confuse your service consumers a lot. The second one is probably a bug.



Careful With Status Codes

.catch(function(err){
  res.status(400).send("Couldnt update question")
})


This is not following RESTful approach. This .catch will be invoked if your code could not update a question. Meaning, the service was not able to fulfill a request. The correct HTTP response code for such situation is 500 Internal Server Error.

You should only return 400 Bad Request if the request was validated and there were issues with the payload (request body received). In such case, HTTP 400 is truly the best option, but in order to improve user experience, you should also provide the information about what exactly was wrong with the request. E.g. HTTP 404 + response payload

{
  "error": {
    "referenceId": "TOO_LONG_QUESTION",
    "description": "Question payload should not exceed 1024kb, however received 2048kb."
  }
}


The response format is actually arbitrary. Just think about what would be useful for a developer to know so that they can start troubleshooting in a right place.



Possible Bug

I numbered the code lines to make it easy to refer to them.

( 1)  collection.update({
( 2)    "synonyms._id": new ObjectId(subId)
( 3)  },
( 4)    {
( 5)        $set: {"synonyms.$.text": newArray}
( 6)    }
( 7)  ).then(function(doc){
( 8)    return updateVersions(dialogName).then(function(){
( 9)        console.log('version updated')
(10)    })
(11)    .catch(function(err){
(12)        console.log('version not saved')
(13)    })
(14)  }).then(function(doc){
(15)    res.status(200).end()
(16)  }).catch(function(err){
(17)    res.status(400).send("Couldnt update question")
(18)  })


If versionCollection.update(...) in updateVersions(...) fails, the promise will be rejected and we will fall into lines 11-13 which is good. There is one problem though... The promise created in line 1 (collection.update(...)) will NOT fail even though we failed to update the versionCollection. Try debugging it and you will see what I mean.

I think, what you need to do there is to re-throw the error like this:

(11)    .catch(function(err){
(12)        console.log('version not saved');
(12')       throw err;  &lt;&lt;-------------------------
(13)    })




Asynchronosity Is NOT Easy

Yes, it's not easy at all. Even with promises. I really recommend you to read about await/async feature of ES2017 which simplifies things a lot.

With await/async your code would look much more "regular" imperative code. It reads as synchronous but acts asynchronously. Here's a sketch (not a 100% working code):

router
  .post('/:dialogName', async (req, res) =&gt; {
    const dialogName = req.params.dialogName;
    const collection = db.get().collection(dialogName);

    try {
      const doc =  await collection.update(
        { "synonyms._id": new ObjectId(req.body.subID) },
        { $set: {"synonyms.$.text": req.body.newArray} }
      );

      try {
        await updateVersions(dialogName);
        console.log('version updated');
      } catch (err) {
        console.log('version not saved');
        throw err;
      }

      res.status(200).end();
    } catch {
      res.status(400).send("Couldnt update question");
    }
  })