title: Enforce limit on mongodb bulk API
body: <p>I'd like to delete a large number of old documents from one collection and so it makes sense to use the bulk api. Deleting them is as simple as:</p>
  
  <pre class="lang-js prettyprint-override"><code>var bulk = db.myCollection.initializeUnorderedBulkOp();
  
  bulk.find({
    _id: {
      $lt: oldestAllowedId
    }
  }).remove();
  
  bulk.execute();
  </code></pre>
  
  <p>The only problem is this will attempt to delete every single document matching this criteria and in this case that is millions of documents, so for performance reasons I don't want to delete them all at once. I want to enforce a limit on the operation so that I can do something like <code>bulk.limit(10000).execute();</code> and space the operations out by a few seconds to prevent locking the database for longer than necessary. However I have been unable to find any options that can be passed to bulk for limiting the number it executes.</p>
  
  <p>Is there a way to limit bulk operations in this manner?</p>
  
  <p>Before anyone mentions it, I know that bulk will split operations into 1000 document chunks automatically, but it will still execute all of those operations sequentially as fast as it can. This results in a much larger performance impact than I can deal with right now.</p>