Add deleteDoc function, getStats. Fix pagination issue with missing results