I thought i would rewrite it in CoffeeScript for you

The structure of the code is essentially the same, except I fixed the issue you were having. You can take the solution out of that if you like or keep using the coffeescript example.

I haven't tested with the mongodb connection in there because i wasn't sure how your private.js file was structured.

run with coffee api.coffee or supervisor api.coffee