@@ -496,50 +496,49 @@ describe('Find', function () {
496
496
}
497
497
} ) ;
498
498
499
- for ( let i = 0 ; i < 500 ; ++ i ) {
500
- it ( 'shouldCorrectlyPerformFindsWithHintTurnedOn' + i , async function ( ) {
501
- const configuration = this . configuration ;
502
- client = configuration . newClient ( configuration . writeConcernMax ( ) , { maxPoolSize : 1 } ) ;
503
- await client . connect ( ) ;
499
+ it ( 'shouldCorrectlyPerformFindsWithHintTurnedOn' , async function ( ) {
500
+ const configuration = this . configuration ;
501
+ client = configuration . newClient ( configuration . writeConcernMax ( ) , { maxPoolSize : 1 } ) ;
502
+ await client . connect ( ) ;
504
503
505
- const db = client . db ( configuration . db ) ;
506
- const collection = await db . createCollection ( 'test_hint' ) ;
504
+ const db = client . db ( configuration . db ) ;
505
+ const collection = await db . createCollection ( 'test_hint' ) ;
507
506
508
- await collection . insert ( { a : 1 } , configuration . writeConcernMax ( ) ) ;
507
+ await collection . deleteMany ( { } ) ;
508
+ await collection . insert ( { a : 1 } , configuration . writeConcernMax ( ) ) ;
509
509
510
- await db . createIndex ( collection . collectionName , 'a' , configuration . writeConcernMax ( ) ) ;
510
+ await db . createIndex ( collection . collectionName , 'a' , configuration . writeConcernMax ( ) ) ;
511
511
512
- expect (
513
- await collection
514
- . find ( { a : 1 } , { hint : 'a' } )
515
- . toArray ( )
516
- . catch ( e => e )
517
- ) . to . be . instanceOf ( Error ) ;
512
+ expect (
513
+ await collection
514
+ . find ( { a : 1 } , { hint : 'a' } )
515
+ . toArray ( )
516
+ . catch ( e => e )
517
+ ) . to . be . instanceOf ( Error ) ;
518
518
519
- // Test with hint as array
520
- expect ( await collection . find ( { a : 1 } , { hint : [ 'a' ] } ) . toArray ( ) ) . to . have . lengthOf ( 1 ) ;
519
+ // Test with hint as array
520
+ expect ( await collection . find ( { a : 1 } , { hint : [ 'a' ] } ) . toArray ( ) ) . to . have . lengthOf ( 1 ) ;
521
521
522
- // Test with hint as object
523
- expect ( await collection . find ( { a : 1 } , { hint : { a : 1 } } ) . toArray ( ) ) . to . have . lengthOf ( 1 ) ;
522
+ // Test with hint as object
523
+ expect ( await collection . find ( { a : 1 } , { hint : { a : 1 } } ) . toArray ( ) ) . to . have . lengthOf ( 1 ) ;
524
524
525
- // Modify hints
526
- collection . hint = 'a_1' ;
527
- expect ( collection . hint ) . to . equal ( 'a_1' ) ;
528
- expect ( await collection . find ( { a : 1 } ) . toArray ( ) ) . to . have . lengthOf ( 1 ) ;
525
+ // Modify hints
526
+ collection . hint = 'a_1' ;
527
+ expect ( collection . hint ) . to . equal ( 'a_1' ) ;
528
+ expect ( await collection . find ( { a : 1 } ) . toArray ( ) ) . to . have . lengthOf ( 1 ) ;
529
529
530
- collection . hint = [ 'a' ] ;
531
- expect ( collection . hint [ 'a' ] ) . to . equal ( 1 ) ;
532
- expect ( await collection . find ( { a : 1 } ) . toArray ( ) ) . to . have . lengthOf ( 1 ) ;
530
+ collection . hint = [ 'a' ] ;
531
+ expect ( collection . hint [ 'a' ] ) . to . equal ( 1 ) ;
532
+ expect ( await collection . find ( { a : 1 } ) . toArray ( ) ) . to . have . lengthOf ( 1 ) ;
533
533
534
- collection . hint = { a : 1 } ;
535
- expect ( collection . hint [ 'a' ] ) . to . equal ( 1 ) ;
536
- expect ( await collection . find ( { a : 1 } ) . toArray ( ) ) . to . have . lengthOf ( 1 ) ;
534
+ collection . hint = { a : 1 } ;
535
+ expect ( collection . hint [ 'a' ] ) . to . equal ( 1 ) ;
536
+ expect ( await collection . find ( { a : 1 } ) . toArray ( ) ) . to . have . lengthOf ( 1 ) ;
537
537
538
- collection . hint = null ;
539
- expect ( collection . hint ) . to . be . null ;
540
- expect ( await collection . find ( { a : 1 } ) . toArray ( ) ) . to . have . lengthOf ( 1 ) ;
541
- } ) ;
542
- }
538
+ collection . hint = null ;
539
+ expect ( collection . hint ) . to . be . undefined ;
540
+ expect ( await collection . find ( { a : 1 } ) . toArray ( ) ) . to . have . lengthOf ( 1 ) ;
541
+ } ) ;
543
542
544
543
it ( 'shouldCorrectlyPerformFindByObjectId' , {
545
544
metadata : {
0 commit comments