Class UpdateResult


  • public class UpdateResult
    extends Object
    The result of an update operation.
    • Constructor Detail

      • UpdateResult

        public UpdateResult​(long matchedCount,
                            long modifiedCount,
                            BsonValue upsertedId)
        Constructs a result.
        Parameters:
        matchedCount - the number of documents matched by the query.
        modifiedCount - the number of documents modified.
        upsertedId - the _id of the inserted document if the replace resulted in an inserted document, otherwise null.
    • Method Detail

      • getMatchedCount

        public long getMatchedCount()
        Returns the number of documents matched by the query.
        Returns:
        the number of documents matched.
      • getModifiedCount

        public long getModifiedCount()
        Returns the number of documents modified.
        Returns:
        the number of documents modified.
      • getUpsertedId

        @Nullable
        public BsonValue getUpsertedId()
        If the replace resulted in an inserted document, gets the _id of the inserted document, otherwise null.
        Returns:
        if the replace resulted in an inserted document, the _id of the inserted document, otherwise null.