@@ -70,7 +70,7 @@ func TestIndexView(t *testing.T) {
70
70
Name : indexName ,
71
71
})
72
72
})
73
- mt .Run ("all options" , func (mt * mtest.T ) {
73
+ mt .RunOpts ("all options" , mtest . NewOptions (). MinServerVersion ( "4.9" ) , func (mt * mtest.T ) {
74
74
opts := options .Index ().
75
75
SetBackground (false ).
76
76
SetExpireAfterSeconds (10 ).
@@ -93,10 +93,37 @@ func TestIndexView(t *testing.T) {
93
93
}},
94
94
})
95
95
96
- // Only check SetBucketSize if version is less than 4.9
97
- if mtest .CompareServerVersions (mtest .ServerVersion (), "4.9" ) < 0 {
98
- opts .SetBucketSize (1 )
99
- }
96
+ // Omits collation option because it's incompatible with version option
97
+ _ , err := mt .Coll .Indexes ().CreateOne (mtest .Background , mongo.IndexModel {
98
+ Keys : bson.D {{"foo" , "text" }},
99
+ Options : opts ,
100
+ })
101
+ assert .Nil (mt , err , "CreateOne error: %v" , err )
102
+ })
103
+ mt .RunOpts ("all options including bucketSize" , mtest .NewOptions ().MaxServerVersion ("4.8" ), func (mt * mtest.T ) {
104
+ opts := options .Index ().
105
+ SetBackground (false ).
106
+ SetExpireAfterSeconds (10 ).
107
+ SetName ("a" ).
108
+ SetSparse (false ).
109
+ SetUnique (false ).
110
+ SetVersion (1 ).
111
+ SetDefaultLanguage ("english" ).
112
+ SetLanguageOverride ("english" ).
113
+ SetTextVersion (1 ).
114
+ SetWeights (bson.D {}).
115
+ SetSphereVersion (1 ).
116
+ SetBits (2 ).
117
+ SetMax (10 ).
118
+ SetMin (1 ).
119
+ SetPartialFilterExpression (bson.D {}).
120
+ SetStorageEngine (bson.D {
121
+ {"wiredTiger" , bson.D {
122
+ {"configString" , "block_compressor=zlib" },
123
+ }},
124
+ }).
125
+ SetBucketSize (1 )
126
+
100
127
// Omits collation option because it's incompatible with version option
101
128
_ , err := mt .Coll .Indexes ().CreateOne (mtest .Background , mongo.IndexModel {
102
129
Keys : bson.D {{"foo" , "text" }},
0 commit comments