Skip to content

Commit 5557a3f

Browse files
committed
Fixed readPreference for ReadBinding operations
JAVA-1954
1 parent 0b95a2f commit 5557a3f

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

driver-core/src/main/com/mongodb/operation/GroupOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public BatchCursor<T> execute(final ReadBinding binding) {
187187
public BatchCursor<T> call(final ConnectionSource connectionSource, final Connection connection) {
188188
return executeWrappedCommandProtocol(namespace.getDatabaseName(), getCommand(),
189189
CommandResultDocumentCodec.create(decoder, "retval"),
190-
connection, transformer(connectionSource, connection));
190+
connection, binding.getReadPreference(), transformer(connectionSource, connection));
191191
}
192192
});
193193
}

driver-core/src/main/com/mongodb/operation/ListCollectionsOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public BatchCursor<T> call(final ConnectionSource source, final Connection conne
175175
if (serverIsAtLeastVersionThreeDotZero(connection.getDescription())) {
176176
try {
177177
return executeWrappedCommandProtocol(databaseName, getCommand(), createCommandDecoder(), connection,
178-
commandTransformer(source));
178+
binding.getReadPreference(), commandTransformer(source));
179179
} catch (MongoCommandException e) {
180180
return rethrowIfNotNamespaceError(e, createEmptyBatchCursor(createNamespace(), decoder,
181181
source.getServerDescription().getAddress(), batchSize));

driver-core/src/main/com/mongodb/operation/ListIndexesOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public BatchCursor<T> call(final ConnectionSource source, final Connection conne
139139
if (serverIsAtLeastVersionThreeDotZero(connection.getDescription())) {
140140
try {
141141
return executeWrappedCommandProtocol(namespace.getDatabaseName(), getCommand(), createCommandDecoder(), connection,
142-
transformer(source));
142+
binding.getReadPreference(), transformer(source));
143143
} catch (MongoCommandException e) {
144144
return rethrowIfNotNamespaceError(e, createEmptyBatchCursor(namespace, decoder,
145145
source.getServerDescription().getAddress(), batchSize));

driver-core/src/main/com/mongodb/operation/MapReduceWithInlineResultsOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public MapReduceBatchCursor<T> execute(final ReadBinding binding) {
308308
public MapReduceBatchCursor<T> call(final ConnectionSource source, final Connection connection) {
309309
return executeWrappedCommandProtocol(namespace.getDatabaseName(), getCommand(),
310310
CommandResultDocumentCodec.create(decoder, "results"),
311-
connection, transformer(source, connection));
311+
connection, binding.getReadPreference(), transformer(source, connection));
312312
}
313313
});
314314
}

driver-core/src/main/com/mongodb/operation/UserExistsOperation.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ public void call(final AsyncConnection connection, final Throwable t) {
8787
} else {
8888
final SingleResultCallback<Boolean> wrappedCallback = releasingCallback(errorHandlingCallback(callback), connection);
8989
if (serverIsAtLeastVersionTwoDotSix(connection.getDescription())) {
90-
executeWrappedCommandProtocolAsync(databaseName, getCommand(), connection, transformer(), wrappedCallback);
90+
executeWrappedCommandProtocolAsync(databaseName, getCommand(), new BsonDocumentCodec(), connection,
91+
binding.getReadPreference(), transformer(), wrappedCallback);
9192
} else {
9293
connection.queryAsync(new MongoNamespace(databaseName, "system.users"),
9394
new BsonDocument("user", new BsonString(userName)), null, 1, 0,

0 commit comments

Comments
 (0)