Skip to content

Commit da844ef

Browse files
committed
Fix functional test of Filters.metaTextScore
Add a $text query filter, which is required starting in MongoDB 4.4. JAVA-3571
1 parent 4ea94c3 commit da844ef

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

driver-core/src/test/functional/com/mongodb/client/model/SortsFunctionalSpecification.groovy

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ import static com.mongodb.client.model.Sorts.orderBy
2727

2828
class SortsFunctionalSpecification extends OperationFunctionalSpecification {
2929
def a = new Document('_id', 1).append('x', 1)
30-
.append('y', 'b')
30+
.append('y', 'bear')
3131

3232
def b = new Document('_id', 2).append('x', 1)
33-
.append('y', 'a')
33+
.append('y', 'albatross')
3434

3535
def c = new Document('_id', 3).append('x', 2)
36-
.append('y', 'c')
36+
.append('y', 'cat')
3737

3838
def setup() {
3939
getCollectionHelper().insertDocuments(a, b, c)
@@ -44,7 +44,11 @@ class SortsFunctionalSpecification extends OperationFunctionalSpecification {
4444
}
4545

4646
def 'find'(Bson sort, Bson projection) {
47-
getCollectionHelper().find(new Document(), sort, projection)
47+
find(new Document(), sort, projection)
48+
}
49+
50+
def 'find'(Bson filter, Bson sort, Bson projection) {
51+
getCollectionHelper().find(filter, sort, projection)
4852
}
4953

5054
def 'ascending'() {
@@ -66,7 +70,8 @@ class SortsFunctionalSpecification extends OperationFunctionalSpecification {
6670
getCollectionHelper().createIndex(new Document('y', 'text'))
6771

6872
expect:
69-
find(metaTextScore('score'), new Document('score', new Document('$meta', 'textScore')))*.containsKey('score')
73+
find(new Document('$text', new Document('$search', 'bear')), metaTextScore('score'),
74+
new Document('score', new Document('$meta', 'textScore')))*.containsKey('score')
7075
}
7176

7277
def 'orderBy'() {

0 commit comments

Comments
 (0)