I consider myself a very experienced node.js developer.
Yet I still wonder if there is a better way to write the following code so I don\'t get the pyramid of doom..
The problem to this sort of thing is promises. If you haven't heard of them, I suggest reading up on kriskowal's q.
Now, I don't know if the db.query returns a promise or not. If it doesn't you might be able to find a db-wrapper that does or a different db library. If that is not an option, you may "promisify" the db-library you're using. See Howto use promises with Node, and especially the section "Wrapping a function that takes a Node-style callback".
Best of luck! :)