this function should probably be moved out of the AbstractPouchDB.prototype.changes function