If you're talking about client-side javascript execution, you are correct (until the browser decides to stop your infinite loop).
Client-side javascript is single threaded so an asynchronous ajax call callback will not execute until the main stream of execution is done and a new stream of javascript execution can be started for the ajax event which will result in calling your ajax callback function.
You can read more about how javascript uses an event queue to serialize all events in this post.
Edit
I see from your edit that you're talking about server-side node.js, not browser code. By default, your callback is not going to run in a new thread so it will either execute immediately as part of the db.get()
function call or more likely will not execute until your current stream of execution is finished and then the db.get()
call is also completed and then the callback can be executed.
node.js does use threads in some situations and does use threads internally, but not in this type of situation.
Here's an good article on threading in node.js.