rename result to allDocs to avoid name conflict
add docstring
allow document apply to change id by save/delete