add document
add first/last which accepts Predicate