Search in sources :

Example 16 with NoOpFieldNameValidator

use of com.mongodb.internal.validator.NoOpFieldNameValidator in project mongo-java-driver by mongodb.

the class CommandOperationHelper method executeCommandAsync.

/* Async Write Binding Helpers */
static <T> void executeCommandAsync(final AsyncWriteBinding binding, final String database, final BsonDocument command, final AsyncConnection connection, final CommandWriteTransformerAsync<BsonDocument, T> transformer, final SingleResultCallback<T> callback) {
    notNull("binding", binding);
    SingleResultCallback<T> addingRetryableLabelCallback = addingRetryableLabelCallback(callback, connection.getDescription().getMaxWireVersion());
    connection.commandAsync(database, command, new NoOpFieldNameValidator(), primary(), new BsonDocumentCodec(), binding.getSessionContext(), binding.getServerApi(), binding.getRequestContext(), transformingWriteCallback(transformer, connection, addingRetryableLabelCallback));
}
Also used : NoOpFieldNameValidator(com.mongodb.internal.validator.NoOpFieldNameValidator) BsonDocumentCodec(org.bson.codecs.BsonDocumentCodec)

Example 17 with NoOpFieldNameValidator

use of com.mongodb.internal.validator.NoOpFieldNameValidator in project mongo-java-driver by mongodb.

the class CommandOperationHelper method createReadCommandAndExecuteAsync.

static <D, T> void createReadCommandAndExecuteAsync(final RetryState retryState, final AsyncReadBinding binding, final AsyncConnectionSource source, final String database, final CommandCreator commandCreator, final Decoder<D> decoder, final CommandReadTransformerAsync<D, T> transformer, final AsyncConnection connection, final SingleResultCallback<T> callback) {
    BsonDocument command;
    try {
        command = commandCreator.create(source.getServerDescription(), connection.getDescription());
        retryState.attach(AttachmentKeys.commandDescriptionSupplier(), command::getFirstKey, false);
        logRetryExecute(retryState);
    } catch (IllegalArgumentException e) {
        callback.onResult(null, e);
        return;
    }
    connection.commandAsync(database, command, new NoOpFieldNameValidator(), source.getReadPreference(), decoder, binding.getSessionContext(), binding.getServerApi(), binding.getRequestContext(), transformingReadCallback(transformer, source, connection, callback));
}
Also used : NoOpFieldNameValidator(com.mongodb.internal.validator.NoOpFieldNameValidator) BsonDocument(org.bson.BsonDocument)

Example 18 with NoOpFieldNameValidator

use of com.mongodb.internal.validator.NoOpFieldNameValidator in project mongo-java-driver by mongodb.

the class FindAndUpdateOperation method getFieldNameValidator.

@Override
protected FieldNameValidator getFieldNameValidator() {
    Map<String, FieldNameValidator> map = new HashMap<String, FieldNameValidator>();
    map.put("update", new UpdateFieldNameValidator());
    return new MappedFieldNameValidator(new NoOpFieldNameValidator(), map);
}
Also used : NoOpFieldNameValidator(com.mongodb.internal.validator.NoOpFieldNameValidator) HashMap(java.util.HashMap) MappedFieldNameValidator(com.mongodb.internal.validator.MappedFieldNameValidator) BsonString(org.bson.BsonString) NoOpFieldNameValidator(com.mongodb.internal.validator.NoOpFieldNameValidator) MappedFieldNameValidator(com.mongodb.internal.validator.MappedFieldNameValidator) FieldNameValidator(org.bson.FieldNameValidator) UpdateFieldNameValidator(com.mongodb.internal.validator.UpdateFieldNameValidator) UpdateFieldNameValidator(com.mongodb.internal.validator.UpdateFieldNameValidator)

Example 19 with NoOpFieldNameValidator

use of com.mongodb.internal.validator.NoOpFieldNameValidator in project mongo-java-driver by mongodb.

the class FindAndReplaceOperation method getFieldNameValidator.

@Override
protected FieldNameValidator getFieldNameValidator() {
    Map<String, FieldNameValidator> map = new HashMap<String, FieldNameValidator>();
    map.put("update", new ReplacingDocumentFieldNameValidator());
    return new MappedFieldNameValidator(new NoOpFieldNameValidator(), map);
}
Also used : NoOpFieldNameValidator(com.mongodb.internal.validator.NoOpFieldNameValidator) ReplacingDocumentFieldNameValidator(com.mongodb.internal.validator.ReplacingDocumentFieldNameValidator) HashMap(java.util.HashMap) MappedFieldNameValidator(com.mongodb.internal.validator.MappedFieldNameValidator) BsonString(org.bson.BsonString) NoOpFieldNameValidator(com.mongodb.internal.validator.NoOpFieldNameValidator) ReplacingDocumentFieldNameValidator(com.mongodb.internal.validator.ReplacingDocumentFieldNameValidator) MappedFieldNameValidator(com.mongodb.internal.validator.MappedFieldNameValidator) FieldNameValidator(org.bson.FieldNameValidator)

Aggregations

NoOpFieldNameValidator (com.mongodb.internal.validator.NoOpFieldNameValidator)19 MappedFieldNameValidator (com.mongodb.internal.validator.MappedFieldNameValidator)6 HashMap (java.util.HashMap)6 FieldNameValidator (org.bson.FieldNameValidator)6 UpdateFieldNameValidator (com.mongodb.internal.validator.UpdateFieldNameValidator)5 BsonString (org.bson.BsonString)5 CollectibleDocumentFieldNameValidator (com.mongodb.internal.validator.CollectibleDocumentFieldNameValidator)4 BsonDocument (org.bson.BsonDocument)4 BsonDocumentCodec (org.bson.codecs.BsonDocumentCodec)4 ReplacingDocumentFieldNameValidator (com.mongodb.internal.validator.ReplacingDocumentFieldNameValidator)2 MongoException (com.mongodb.MongoException)1 ServerAddress (com.mongodb.ServerAddress)1 DeleteRequest (com.mongodb.bulk.DeleteRequest)1 UpdateRequest (com.mongodb.bulk.UpdateRequest)1 ClusterDescription (com.mongodb.connection.ClusterDescription)1 ServerDescription (com.mongodb.connection.ServerDescription)1 Connection (com.mongodb.internal.connection.Connection)1 ReadPreferenceServerSelector (com.mongodb.internal.selector.ReadPreferenceServerSelector)1 ServerAddressSelector (com.mongodb.internal.selector.ServerAddressSelector)1 ServerSelector (com.mongodb.selector.ServerSelector)1