This patch increments the # deleted documents once for each call to $deleteDocById and/or $deleteDocByQuery. Note that it would be even better (especially with ..byQuery) to get the actual # of deleted documents and increment by that many.
By incrementing the # deleted documents, "commit" is called at the end of the run as expected. This fixes the issue of commit not being called and also causes the # of deleted documents to be reported back to the user. While this is better than current behavior, the actual # of reported deletions may not be accurate because a call to $deleteDocById may not actually delete a document. Likewise a call to $deleteDocByQuery could delete more than 1 document (or none).
A unit test is provided.