@@ -178,6 +178,7 @@ class CountOperationSpecification extends OperationFunctionalSpecification {
178
178
[async, strategy] << [[true , false ], [CountStrategy . AGGREGATE , CountStrategy . COMMAND ]]. combinations()
179
179
}
180
180
181
+ @IgnoreIf ({ !serverVersionAtLeast(3 , 6 ) })
181
182
def ' should use hint with the count' () {
182
183
given :
183
184
def indexDefinition = new BsonDocument (' y' , new BsonInt32 (1 ))
@@ -189,13 +190,23 @@ class CountOperationSpecification extends OperationFunctionalSpecification {
189
190
def count = execute(operation, async)
190
191
191
192
then :
192
- count == (serverVersionAtLeast( 3 , 4 ) ? 1 : documents . size())
193
+ count == 1
193
194
194
195
where :
195
196
[async, strategy] << [[true , false ], [CountStrategy . AGGREGATE , CountStrategy . COMMAND ]]. combinations()
196
197
}
197
198
198
- def ' should throw with bad hint with mongod 2.6+' () {
199
+ @IgnoreIf ({ !serverVersionAtLeast(3 , 6 ) })
200
+ def ' should support hints that are bson documents or strings' () {
201
+ expect :
202
+ execute(new CountOperation (getNamespace(), strategy). hint(hint), async) == 5
203
+
204
+ where :
205
+ [async, strategy, hint] << [[true , false ], [CountStrategy . AGGREGATE , CountStrategy . COMMAND ],
206
+ [new BsonString (' _id_' ), BsonDocument . parse(' {_id: 1}' )]]. combinations()
207
+ }
208
+
209
+ def ' should throw with bad hint' () {
199
210
given :
200
211
def operation = new CountOperation (getNamespace(), strategy)
201
212
.filter(new BsonDocument (' a' , new BsonInt32 (1 )))
@@ -211,15 +222,6 @@ class CountOperationSpecification extends OperationFunctionalSpecification {
211
222
[async, strategy] << [[true , false ], [CountStrategy . AGGREGATE , CountStrategy . COMMAND ]]. combinations()
212
223
}
213
224
214
- def ' should support hints that are bson documents or strings' () {
215
- expect :
216
- execute(new CountOperation (getNamespace(), strategy). hint(hint), async) == 5
217
-
218
- where :
219
- [async, strategy, hint] << [[true , false ], [CountStrategy . AGGREGATE , CountStrategy . COMMAND ],
220
- [new BsonString (' _id_' ), BsonDocument . parse(' {_id: 1}' )]]. combinations()
221
- }
222
-
223
225
@IgnoreIf ({ !serverVersionAtLeast(3 , 0 ) || isSharded() })
224
226
def ' should explain' () {
225
227
when :
0 commit comments