`function(err, doc){` should be `function (err, doc) {`, missing a space after function and before the {