title: Mongoose Find and Remove
body: <p>I'm trying to delete multiple documents that satisfy a query. However I need the data of those documents for storing them in a separate collection for undo functionality. The only way I got this to work is with multiple queries:</p>
  
  <pre><code>Data.find(query).exec(function(err, data)
  {
      Data.remove(query).exec(function(err2)
      {
          ActionCtrl.saveRemove(data);
      });
  });
  </code></pre>
  
  <p>Is there a better way? In this post: <a href="https://stackoverflow.com/questions/5809788/how-do-i-remove-documents-using-node-js-mongoose">How do I remove documents using Node.js Mongoose?</a> it was suggested to use find().remove().exec():</p>
  
  <pre><code>Data.find(query).remove().exec(function(err, data)
  {
      ActionCtrl.saveRemove(data);
  });
  </code></pre>
  
  <p>However <code>data</code> is usually <code>1</code>, don't ask me why. Can I do this without infinitely nesting my queries? Thanks!</p>