There is a typo in the callback of the .connect
function. You exchanged the error with the result in the argument positions, so you are printing the database object instead the error. It should be:
.connect("mongodb://localhost:27017/course",function(err,db){