There's an in-memory cache for total_rows (aka doc_count) in the IDB adapter. This is cute and has some perf benefits, but it also introduces inconsistencies between the worker thread and main thread because we're caching stuff in-memory, outside of the IDB transaction.
Given the increasing usage of web workers and service workers, I don't think this is a safe tradeoff to make anymore. We should just remove this optimization and look for other, safer optimizations.
Technically you can also reproduce this by just using the same PouchDB in multiple tabs, so it's not safe for that case either.
(#6055) - remove docCount optimization from IDB
(#6055) - remove docCount optimization from WebSQL
Removes this unsafe optimization.