Skip to content

Instantly share code, notes, and snippets.

@addisonj
Created August 22, 2011 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save addisonj/1163207 to your computer and use it in GitHub Desktop.
Save addisonj/1163207 to your computer and use it in GitHub Desktop.
example of nested return from db
app.get('/jobs/:id', checkAuth, function(req, res, next) {
Job.findOne({ _id: req.params.id, user_id: req.session.user._id }, function(err, j) {
if (!j) return(new NotFound());
res.render('jobs/show', {
locals: {
j: j,
user: req.session.user
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment