Some documents are skipped during migrations
During migrations, some documents were not properly updated. Further investigation revealed that the same documents are affected when repeating the migrations against the same database state.
Document updates during migrations are handled in batches. Batches of 200 documents are retrieved which are then iterated for modification and finally sent in bulk to the database for updating. There is a off-by-one issue for each batch following the first one: The first expected document is not returned by the database.
There seems to be an issue when Mango bookmarks are used and the last document of a page is changed in a way that it would no longer be match the query selector.
I have opened an issue in the official CouchDB repository describing this issue in detail: https://github.com/apache/couchdb/issues/3657