@@ -178,6 +178,7 @@ class CountOperationSpecification extends OperationFunctionalSpecification {
178178 [async, strategy] << [[true , false ], [CountStrategy . AGGREGATE , CountStrategy . COMMAND ]]. combinations()
179179 }
180180
181+ @IgnoreIf ({ !serverVersionAtLeast(3 , 6 ) })
181182 def ' should use hint with the count' () {
182183 given :
183184 def indexDefinition = new BsonDocument (' y' , new BsonInt32 (1 ))
@@ -189,13 +190,23 @@ class CountOperationSpecification extends OperationFunctionalSpecification {
189190 def count = execute(operation, async)
190191
191192 then :
192- count == (serverVersionAtLeast( 3 , 4 ) ? 1 : documents . size())
193+ count == 1
193194
194195 where :
195196 [async, strategy] << [[true , false ], [CountStrategy . AGGREGATE , CountStrategy . COMMAND ]]. combinations()
196197 }
197198
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' () {
199210 given :
200211 def operation = new CountOperation (getNamespace(), strategy)
201212 .filter(new BsonDocument (' a' , new BsonInt32 (1 )))
@@ -211,15 +222,6 @@ class CountOperationSpecification extends OperationFunctionalSpecification {
211222 [async, strategy] << [[true , false ], [CountStrategy . AGGREGATE , CountStrategy . COMMAND ]]. combinations()
212223 }
213224
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-
223225 @IgnoreIf ({ !serverVersionAtLeast(3 , 0 ) || isSharded() })
224226 def ' should explain' () {
225227 when :
0 commit comments