Interface Bulk.BulkSpec

Enclosing interface:
Bulk

public static interface Bulk.BulkSpec
Builder for adding bulk operations (insert, update, replace, remove) to a single collection.
Since:
5.1
Author:
Christoph Strobl, Mark Paluch
  • Method Details

    • insert

      Bulk.BulkSpec insert(Object object)
      Adds an insert of the given document.
      Parameters:
      object - the document to insert.
      Returns:
      this builder.
    • insertAll

      Bulk.BulkSpec insertAll(Iterable<? extends Object> objects)
      Adds inserts for all given documents.
      Parameters:
      objects - the documents to insert.
      Returns:
      this builder.
    • updateOne

      default Bulk.BulkSpec updateOne(CriteriaDefinition where, UpdateDefinition update)
      Adds an update-one operation (update at most one document matching the criteria).
      Parameters:
      where - criteria to select the document.
      update - the update to apply.
      Returns:
      this builder.
    • updateOne

      Bulk.BulkSpec updateOne(Query filter, UpdateDefinition update)
      Adds an update-one operation (update at most one document matching the filter).
      Parameters:
      filter - the query to select the document.
      update - the update to apply.
      Returns:
      this builder.
    • updateMulti

      default Bulk.BulkSpec updateMulti(CriteriaDefinition where, UpdateDefinition update)
      Adds an update-many operation (update all documents matching the criteria).
      Parameters:
      where - criteria to select the document.
      update - the update to apply.
      Returns:
      this builder.
    • updateMulti

      Bulk.BulkSpec updateMulti(Query filter, UpdateDefinition update)
      Adds an update-many operation (update all documents matching the filter).
      Parameters:
      filter - the query to select documents.
      update - the update to apply.
      Returns:
      this builder.
    • upsert

      default Bulk.BulkSpec upsert(CriteriaDefinition criteria, UpdateDefinition update)
      Adds an upsert operation (update if a document matches the criteria, otherwise insert).
      Parameters:
      criteria - the match criteria to find an existing document.
      update - the update to apply or use for the new dozcument.
      Returns:
      this builder.
    • upsert

      Bulk.BulkSpec upsert(Query filter, UpdateDefinition update)
      Adds an upsert operation (update if a document matches the filter, otherwise insert).
      Parameters:
      filter - the query to find an existing document.
      update - the update to apply or use for the new document.
      Returns:
      this builder.
    • remove

      default Bulk.BulkSpec remove(CriteriaDefinition criteria)
      Adds a remove operation (delete all documents matching the criteria).
      Parameters:
      criteria - the match criteria for documents to delete.
      Returns:
      this builder.
    • remove

      Bulk.BulkSpec remove(Query filter)
      Adds a remove operation (delete all documents matching the filter).
      Parameters:
      filter - the query to select documents to delete.
      Returns:
      this builder.
    • replaceOne

      default Bulk.BulkSpec replaceOne(CriteriaDefinition where, Object replacement)
      Adds a replace-one operation (replace at most one document matching the criteria).
      Parameters:
      where - the criteria to select the document.
      replacement - the replacement document.
      Returns:
      this builder.
    • replaceOne

      Bulk.BulkSpec replaceOne(Query filter, Object replacement)
      Adds a replace-one operation (replace at most one document matching the filter).
      Parameters:
      filter - the query to select the document.
      replacement - the replacement document.
      Returns:
      this builder.
    • replaceIfExists

      default Bulk.BulkSpec replaceIfExists(CriteriaDefinition where, Object replacement)
      Adds a replace-one-if-exists operation (replace only if a document matches the criteria).
      Parameters:
      where - the criteria to select the document.
      replacement - the replacement document.
      Returns:
      this builder.
    • replaceIfExists

      Bulk.BulkSpec replaceIfExists(Query filter, Object replacement)
      Adds a replace-one-if-exists operation (replace only if a document matches the filter).
      Parameters:
      filter - the query to select the document.
      replacement - the replacement document.
      Returns:
      this builder.