static boolean bypassDocumentValidationNotSupported(
     final Boolean bypassDocumentValidation,
     final WriteConcern writeConcern,
     final ConnectionDescription description) {
   return bypassDocumentValidation != null
       && serverIsAtLeastVersionThreeDotTwo(description)
       && !writeConcern.isAcknowledged();
 }
Ejemplo n.º 2
0
 static void checkBypassDocumentValidationIsSupported(
     final Connection connection,
     final Boolean bypassDocumentValidation,
     final WriteConcern writeConcern) {
   if (bypassDocumentValidation != null
       && serverIsAtLeastVersionThreeDotTwo(connection.getDescription())
       && !writeConcern.isAcknowledged()) {
     throw new MongoClientException(
         "Specifying bypassDocumentValidation with an unacknowledged WriteConcern is not supported");
   }
 }
Ejemplo n.º 3
0
 static void validateCollationAndWriteConcern(
     final Connection connection, final Collation collation, final WriteConcern writeConcern) {
   if (!serverIsAtLeastVersionThreeDotFour(connection.getDescription()) && collation != null) {
     throw new IllegalArgumentException(
         format(
             "Collation not supported by server version: %s",
             connection.getDescription().getServerVersion()));
   } else if (collation != null && !writeConcern.isAcknowledged()) {
     throw new MongoClientException(
         "Specifying collation with an unacknowledged WriteConcern is not supported");
   }
 }
Ejemplo n.º 4
0
 static void checkBypassDocumentValidationIsSupported(
     final AsyncConnection connection,
     final Boolean bypassDocumentValidation,
     final WriteConcern writeConcern,
     final AsyncCallableWithConnection callable) {
   Throwable throwable = null;
   if (bypassDocumentValidation != null
       && serverIsAtLeastVersionThreeDotTwo(connection.getDescription())
       && !writeConcern.isAcknowledged()) {
     throwable =
         new MongoClientException(
             "Specifying bypassDocumentValidation with an unacknowledged WriteConcern is "
                 + "not supported");
   }
   callable.call(connection, throwable);
 }