protected final FluentFuture<Optional<T>> doModify(
            final Constraints.ConstraintHost criteria,
            final Constraints.Constraint update,
            final FindOneAndUpdateOptions options) {

      checkNotNull(criteria, "criteria");
      checkNotNull(update, "update");

      return submit(new Callable<Optional<T>>() {
        @Override
        public Optional<T> call() throws Exception {
          @Nullable T result = collection().findOneAndUpdate(
                  convertToBson(criteria),
                  convertToBson(update),
                  options);

          return Optional.fromNullable(result);
        }
      });
    }
Codec used for current collection type.
@return registry
mongo/src/org/immutables/mongo/repository/Repositories.java