title: How to Lint code if I need additional mongodb request
body: <p>Today I have this code. I learning NodeJS and all the time I have same question: I have a route. This route doing something, thats why I need some mongodb requests. In different ways I can need additional options or not. For example please look on my code:</p>
  
  <pre><code>const express = require('express');
  const router = express.Router();
  const debug = require('debug')('hackit:posts');
  const boom = require('boom');
  
  const config = require('../../config');
  const db = require('monk')(config.mdbConnect);
  const DBpgs = db.get('pgs');
  const DBposts = db.get('posts');
  const DBcategories = db.get('categories');
  
  router.route( "/edit-:id" )
    .get((req,res,next) =&gt; {
      const ops ={
        h1: "Edit post",
        title: "Admin edit post",
        description: "Admin page",
        specialscript: "/javascripts/editpost.js"
      };
      DBposts.findOne({_id: req.params.id}, (err, saved) =&gt; {
        if(saved.h1.length) debug('Edit «'+saved.h1+'»')
        else debug('Create new post')
        if(err) next(boom.badImplementation(err))
        DBcategories.find({}, (err, categories) =&gt; {
          if(err) next(boom.badImplementation(err))
          let group = {}
          if(saved.parent&amp;&amp;saved.parent.length){
            DBpgs.findOne({parent: saved.parent}, (err, group) =&gt; {
              if(err) next(boom.badImplementation(err))
              res.render('admin/post', {ops, saved, categories, group})
            })
          }else{
            res.render('admin/post', {ops, saved, categories, group})
          }
        })
      })
    })
  
  module.exports = router;
  </code></pre>
  
  <p>There is only one route. The problem is if I got <code>saved.parent</code> I need to do additional request to db, to pick <code>group</code> options. I solved it just by <code>if</code> and ... its looks rude. Next two lines i type <code>res.render('admin/post', {ops, saved, categories, group})</code> witch is the same line of code. I want to be a good programmer. Lint my code and say how I must fill my code please. Thanks!</p>