Package com.mongodb

Class BulkWriteRequestBuilder


  • public class BulkWriteRequestBuilder
    extends 
    A builder for a single write request.
    Since:
    2.12
    MongoDB documentation
    Since server release
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      BulkUpdateRequestBuilder <? extends DBObject> arrayFilters)
      Specifies that the request being built should use the given array filters for an update.
      BulkWriteRequestBuilder collation​(Collation collation)
      Sets the collation
      Collation getCollation()
      Returns the collation
      void remove()
      Adds a request to remove all documents in the collection that match the query with which this builder was created.
      void removeOne()
      Adds a request to remove one document in the collection that matches the query with which this builder was created.
      void replaceOne​(DBObject document)
      Adds a request to replace one document in the collection that matches the query with which this builder was created.
      void update​(DBObject update)
      Adds a request to update all documents in the collection that match the query with which this builder was created.
      void updateOne​(DBObject update)
      Adds a request to update one document in the collection that matches the query with which this builder was created.
      BulkUpdateRequestBuilder upsert()
      Specifies that the request being built should be an upsert.
      • Methods inherited from class java.lang.

        , , , , , , , , , ,
    • Method Detail

      • getCollation

        @Nullable
        public Collation getCollation()
        Returns the collation
        Returns:
        the collation
        Since:
        3.4
        Since server release
      • remove

        public void remove()
        Adds a request to remove all documents in the collection that match the query with which this builder was created.
      • removeOne

        public void removeOne()
        Adds a request to remove one document in the collection that matches the query with which this builder was created.
      • replaceOne

        public void replaceOne​(DBObject document)
        Adds a request to replace one document in the collection that matches the query with which this builder was created.
        Parameters:
        document - the replacement document, which must be structured just as a document you would insert. It can not contain any update operators.
      • update

        public void update​(DBObject update)
        Adds a request to update all documents in the collection that match the query with which this builder was created.
        Parameters:
        update - the update criteria
      • updateOne

        public void updateOne​(DBObject update)
        Adds a request to update one document in the collection that matches the query with which this builder was created.
        Parameters:
        update - the update criteria
      • upsert

        public BulkUpdateRequestBuilder upsert()
        Specifies that the request being built should be an upsert.
        Returns:
        a new builder that allows only update and replace, since upsert does not apply to remove.
        MongoDB documentation
      • arrayFilters

        public <? extends DBObject> arrayFilters)
        Specifies that the request being built should use the given array filters for an update. Note that this option only applies to update operations and will be ignored for replace operations
        Parameters:
        arrayFilters - the array filters to apply to the update operation
        Returns:
        a new builder that allows only update and replace, since upsert does not apply to remove.
        Since:
        3.6
        Since server release