Package com.mongodb

Class WriteResult


  • @Deprecated(since="2021-05-27")
    public class WriteResult
    extends java.lang.Object
    Deprecated.
    Usage of this API is not supported in AEM as a Cloud Service.
    This class lets you access the results of the previous acknowledged write. If the write was unacknowledged, all property access methods will throw UnsupportedOperationException.
    See Also:
    WriteConcern.UNACKNOWLEDGED
    • Constructor Summary

      Constructors 
      Constructor Description
      WriteResult​(int n, boolean updateOfExisting, java.lang.Object upsertedId)
      Deprecated.
      Construct a new instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      int getN()
      Deprecated.
      Gets the "n" field, which contains the number of documents affected in the write operation.
      java.lang.Object getUpsertedId()
      Deprecated.
      Gets the _id value of an upserted document that resulted from this write.
      boolean isUpdateOfExisting()
      Deprecated.
      Returns true if this write resulted in an update of an existing document.
      java.lang.String toString()
      Deprecated.
       
      static WriteResult unacknowledged()
      Deprecated.
      Gets an instance representing an unacknowledged write.
      boolean wasAcknowledged()
      Deprecated.
      Returns true if the write was acknowledged.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • WriteResult

        public WriteResult​(int n,
                           boolean updateOfExisting,
                           @Nullable
                           java.lang.Object upsertedId)
        Deprecated.
        Construct a new instance.
        Parameters:
        n - the number of existing documents affected by this operation
        updateOfExisting - true if the operation was an update and an existing document was updated
        upsertedId - the _id of a document that was upserted by this operation, which may be null
    • Method Detail

      • unacknowledged

        public static WriteResult unacknowledged()
        Deprecated.
        Gets an instance representing an unacknowledged write.
        Returns:
        an instance representing an unacknowledged write
        Since:
        3.0
      • wasAcknowledged

        public boolean wasAcknowledged()
        Deprecated.
        Returns true if the write was acknowledged.
        Returns:
        true if the write was acknowledged
        Since:
        3.0
        See Also:
        WriteConcern.UNACKNOWLEDGED
      • getN

        public int getN()
        Deprecated.
        Gets the "n" field, which contains the number of documents affected in the write operation.
        Returns:
        the value of the "n" field
        Throws:
        java.lang.UnsupportedOperationException - if the write was unacknowledged
        See Also:
        WriteConcern.UNACKNOWLEDGED
      • getUpsertedId

        @Nullable
        public java.lang.Object getUpsertedId()
        Deprecated.
        Gets the _id value of an upserted document that resulted from this write. Note that for MongoDB servers prior to version 2.6, this method will return null unless the _id of the upserted document was of type ObjectId.
        Returns:
        the value of the _id of an upserted document, which may be null
        Throws:
        java.lang.UnsupportedOperationException - if the write was unacknowledged
        Since:
        2.12
      • isUpdateOfExisting

        public boolean isUpdateOfExisting()
        Deprecated.
        Returns true if this write resulted in an update of an existing document.
        Returns:
        whether the write resulted in an update of an existing document.
        Throws:
        java.lang.UnsupportedOperationException - if the write was unacknowledged
        Since:
        2.12
      • toString

        public java.lang.String toString()
        Deprecated.
        Overrides:
        toString in class java.lang.Object