public static WriteConcernResult acknowledged ( final int count , final boolean isUpdateOfExisting , @ Nullable final BsonValue upsertedId ) { return new WriteConcernResult ( ) { @ Override public boolean wasAcknowledged ( ) { return true ; } @ Override public int getCount ( ) { return count ; } @ Override public boolean isUpdateOfExisting ( ) { return isUpdateOfExisting ; } @ Override @ Nullable public BsonValue getUpsertedId ( ) { return upsertedId ; } @ Override public boolean equals ( final Object o ) { if ( this == o ) { return true ; } if ( o == null || getClass ( ) != o . getClass ( ) ) { return false ; } WriteConcernResult that = ( WriteConcernResult ) o ; if ( ! that . wasAcknowledged ( ) ) { return false ; } if ( count != that . getCount ( ) ) { return false ; } if ( isUpdateOfExisting != that . isUpdateOfExisting ( ) ) { return false ; } if ( upsertedId != null ? ! upsertedId . equals ( that . getUpsertedId ( ) ) : that . getUpsertedId ( ) != null ) { return false ; } return true ; } @ Override public int hashCode ( ) { int result = count ; result = 31 * result + ( isUpdateOfExisting ? 1 : 0 ) ; result = 31 * result + ( upsertedId != null ? upsertedId . hashCode ( ) : 0 ) ; return result ; } @ Override public String toString ( ) { return "AcknowledgedWriteResult{" + "count=" + count + ", isUpdateOfExisting=" + isUpdateOfExisting + ", upsertedId=" + upsertedId + ' ' ; } } ; }
Create an acknowledged WriteConcernResult