Interface Bulk


public interface Bulk
Container for an ordered list of bulk operations that modify documents in one or more collections within a single request. Execution can be ordered (serial, stop on first error) or unordered (possibly parallel, continue on errors).
Since:
5.1
Author:
Christoph Strobl, Mark Paluch
  • Method Details

    • operations

      List<BulkOperation> operations()
      Returns the ordered list of bulk operations to execute.
      Returns:
      the ordered list of operations.
    • create

      static Bulk create(Consumer<Bulk.BulkBuilder> builderCustomizer)
      Creates a new Bulk by applying the given builder customizer to a fresh Bulk.BulkBuilder.
      Parameters:
      builderCustomizer - the customizer that configures the builder with operations.
      Returns:
      a new Bulk instance.
    • builder

      static Bulk.BulkBuilder builder()
      Returns a new Bulk.BulkBuilder to define and build a Bulk.
      Bulk bulk = Bulk.builder()
          .inCollection(Person.class, it -> it..insert(p1).upsert(where(...)))
          .inCollection("user", it -> it.update(where(...), ...)
          .build();
      
      Returns:
      a new Bulk.BulkBuilder.