Class FindOneAndDeleteOptions


  • public class FindOneAndDeleteOptions
    extends java.lang.Object
    The options to apply to an operation that atomically finds a document and deletes it.
    Since:
    3.0
    MongoDB documentation
    reference/command/findAndModify/
    • Constructor Detail

      • FindOneAndDeleteOptions

        public FindOneAndDeleteOptions()
      • FindOneAndDeleteOptions

        public FindOneAndDeleteOptions​(JsonObject json)
    • Method Detail

      • setProjection

        public FindOneAndDeleteOptions setProjection​(JsonObject projection)
        Sets a document describing the fields to return for all matching documents.
        Parameters:
        projection - the project document, which may be null.
        Returns:
        this
        MongoDB documentation
        Projection
      • getProjection

        public JsonObject getProjection()
        Gets a document describing the fields to return for all matching documents.
        Returns:
        the project document, which may be null
        MongoDB documentation
        Projection
      • setSort

        public FindOneAndDeleteOptions setSort​(JsonObject sort)
        Sets the sort criteria to apply to the query.
        Parameters:
        sort - the sort criteria, which may be null.
        Returns:
        this
        MongoDB documentation
        Sort
      • getSort

        public JsonObject getSort()
        Gets the sort criteria to apply to the query. The default is null, which means that the documents will be returned in an undefined order.
        Returns:
        a document describing the sort criteria
        MongoDB documentation
        Sort
      • setMaxTime

        public FindOneAndDeleteOptions setMaxTime​(java.lang.Long maxTime)
        Sets the maximum execution time on the server for this operation.
        Parameters:
        maxTime - the max time (in milliseconds)
        Returns:
        this
      • getMaxTime

        public java.lang.Long getMaxTime()
        Gets the maximum execution time for the find one and delete operation.
        Returns:
        the max time
      • setCollation

        public FindOneAndDeleteOptions setCollation​(Collation collation)
        Sets the collation options

        A null value represents the server default.

        Parameters:
        collation - the collation options to use
        Returns:
        this
        Since:
        3.4
        Since server release
        3.4
      • getCollation

        public Collation getCollation()
        Returns the collation options
        Returns:
        the collation options
        Since:
        3.4
        Since server release
        3.4
      • setHint

        public FindOneAndDeleteOptions setHint​(JsonObject hint)
        Sets the hint to apply.
        Parameters:
        hint - a document describing the index which should be used for this operation.
        Returns:
        this
        Since:
        4.1
        Since server release
        4.4
      • getHint

        public JsonObject getHint()
        Gets the hint to apply.
        Returns:
        the hint, which should describe an existing index
        Since:
        4.1
        Since server release
        4.4
      • setHintString

        public FindOneAndDeleteOptions setHintString​(java.lang.String hint)
        Sets the hint to apply.

        Note: If setHint(JsonObject) is set that will be used instead of any hint string.

        Parameters:
        hint - the name of the index which should be used for the operation
        Returns:
        this
        Since:
        4.1
        Since server release
        4.4
      • getHintString

        public java.lang.String getHintString()
        Gets the hint string to apply.
        Returns:
        the hint string, which should be the name of an existing index
        Since:
        4.1
        Since server release
        4.4