Skip to content

Commit 049892b

Browse files
committed
Test: Fixed FindOperationSpecification for latest MongoDB version
1 parent 672024a commit 049892b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

driver-core/src/test/functional/com/mongodb/operation/FindOperationSpecification.groovy

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import static com.mongodb.CursorType.Tailable
6060
import static com.mongodb.CursorType.TailableAwait
6161
import static com.mongodb.ExplainVerbosity.QUERY_PLANNER
6262
import static com.mongodb.connection.ServerType.STANDALONE
63+
import static java.util.Arrays.asList
6364
import static java.util.concurrent.TimeUnit.MILLISECONDS
6465
import static java.util.concurrent.TimeUnit.SECONDS
6566
import static org.junit.Assert.assertEquals
@@ -463,10 +464,12 @@ class FindOperationSpecification extends OperationFunctionalSpecification {
463464

464465
then:
465466
Document profileDocument = profileCollectionHelper.find().get(0)
466-
if (serverVersionAtLeast(3, 2)) {
467-
assertEquals(expectedComment, ((Document) profileDocument.get('query')).get('comment'));
467+
if (serverVersionAtLeast(asList(3, 5, 8))) {
468+
assertEquals(expectedComment, ((Document) profileDocument.get('command')).get('comment'))
469+
} else if (serverVersionAtLeast(3, 2)) {
470+
assertEquals(expectedComment, ((Document) profileDocument.get('query')).get('comment'))
468471
} else {
469-
assertEquals(expectedComment, ((Document) profileDocument.get('query')).get('$comment'));
472+
assertEquals(expectedComment, ((Document) profileDocument.get('query')).get('$comment'))
470473
}
471474

472475
cleanup:

0 commit comments

Comments
 (0)