Node.js native libraries (not parts of JavaScript) use separate threads all the time, but all the data for your code is shuffled back into a single JavaScript execution thread.
It is impossible to say whether other topics are running in the background for this request, since you did not specify which database library you are using. However, this is not as important as you think.
Suppose you have to create a thread to handle a database connection. You run a query, and this thread takes care of receiving the query on the database server. So what? This thread sits around absolutely nothing until the data returns. You have effectively wasted resources maintaining a stream around that doesn't do much. Node.js does not work this way. You have one thread to execute JavaScript.
If you send or receive data (basically this is what your DB port will do), then you automatically load the background thread pool. It is also possible that any DB connector you use has its own extension, which can do anything with streams.
See my post here for a more complete explanation: fooobar.com/questions/693417 / ...
source share