Skip to content

Commit baaea7a

Browse files
committed
JAVA-2737: Change expectations for $readPreference in CommandMonitoringTest
1 parent cb5e586 commit baaea7a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

driver/src/test/functional/com/mongodb/client/CommandMonitoringTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ private List<CommandEvent> getExpectedEvents(final BsonArray expectedEventDocume
314314
BsonDocument operation = definition.getDocument("operation");
315315
if (operation.containsKey("read_preference")) {
316316
commandDocument.put("$readPreference", operation.getDocument("read_preference"));
317+
} else if (!isDiscoverableReplicaSet() && !isSharded()) {
318+
commandDocument.put("$readPreference", ReadPreference.primaryPreferred().toDocument());
317319
}
318320
}
319321
commandEvent = new CommandStartedEvent(1, null, databaseName, commandName, commandDocument);

0 commit comments

Comments
 (0)