title: Delete all documents/records when deleting user
body: <p>I need to figure out how to delete all documents in a mongo database where the email is <code>req.user.email</code> when I execute my code for deleting an account. Currently it just deletes the account and leaves the users old documents and is filling up my database with useless data. I am using node.js, express.js, mongodb and mongoose.js</p>
  
  <p>I have many collections ~10 What is the best way to clean everything up when a user leaves.</p>
  
  <p><strong>My delete account code</strong></p>
  
  <pre><code>exports.deleteAccount = function(req, res, next){
   User.findById(req.user.id, function(err, user) {
    if (err) return next(err);
  
  user.remove(function (err, user) {
    if (err) return next(err);
    user.cancelStripe(function(err){
      if (err) return next(err);
  
      req.logout();
      req.flash('info', { msg: 'Your account has been deleted.' });
      res.redirect(req.redirect.success);
     });
    });
   });
  };
  </code></pre>
  
  <p>I am thinking this might be it then do it for each collection?</p>
  
  <pre><code>Asset.find({"author.id":req.user.id}, (err, assetReturned)=&gt;{
   assetReturned.remove((err, asset) =&gt;{
     if (err) return next(err);
   });
  });
  </code></pre>