@@ -645,10 +645,9 @@ describe('Explain', function () {
645
645
. aggregate ( [ { $project : { a : 1 } } , { $group : { _id : '$a' } } ] , { explain : true } )
646
646
. toArray ( ( err , docs ) => {
647
647
expect ( err ) . to . not . exist ;
648
- const result = docs [ 0 ] ;
649
- expect ( result ) . to . have . property ( 'stages' ) ;
650
- expect ( result . stages ) . to . have . lengthOf . at . least ( 1 ) ;
651
- expect ( result . stages [ 0 ] ) . to . have . property ( '$cursor' ) ;
648
+ const result = JSON . stringify ( docs [ 0 ] ) ;
649
+ expect ( result ) . to . include ( '"queryPlanner"' ) ;
650
+ expect ( result ) . to . include ( '"executionStats"' ) ;
652
651
done ( ) ;
653
652
} ) ;
654
653
} ) ;
@@ -675,12 +674,9 @@ describe('Explain', function () {
675
674
} )
676
675
. toArray ( ( err , docs ) => {
677
676
expect ( err ) . to . not . exist ;
678
- const result = docs [ 0 ] ;
679
- expect ( result ) . to . have . property ( 'stages' ) ;
680
- expect ( result . stages ) . to . have . lengthOf . at . least ( 1 ) ;
681
- expect ( result . stages [ 0 ] ) . to . have . property ( '$cursor' ) ;
682
- expect ( result . stages [ 0 ] . $cursor ) . to . have . property ( 'queryPlanner' ) ;
683
- expect ( result . stages [ 0 ] . $cursor ) . to . have . property ( 'executionStats' ) ;
677
+ const result = JSON . stringify ( docs [ 0 ] ) ;
678
+ expect ( result ) . to . include ( '"queryPlanner"' ) ;
679
+ expect ( result ) . to . include ( '"executionStats"' ) ;
684
680
done ( ) ;
685
681
} ) ;
686
682
} ) ;
@@ -699,11 +695,11 @@ describe('Explain', function () {
699
695
700
696
collection
701
697
. aggregate ( [ { $project : { a : 1 } } , { $group : { _id : '$a' } } ] )
702
- . explain ( false , ( err , result ) => {
698
+ . explain ( false , ( err , res ) => {
703
699
expect ( err ) . to . not . exist ;
704
- expect ( result ) . to . have . property ( 'stages' ) ;
705
- expect ( result . stages ) . to . have . lengthOf . at . least ( 1 ) ;
706
- expect ( result . stages [ 0 ] ) . to . have . property ( '$cursor ') ;
700
+ const result = JSON . stringify ( res ) ;
701
+ expect ( result ) . to . include ( '"queryPlanner"' ) ;
702
+ expect ( result ) . not . to . include ( '"executionStats" ') ;
707
703
done ( ) ;
708
704
} ) ;
709
705
} ) ;
@@ -726,14 +722,12 @@ describe('Explain', function () {
726
722
727
723
collection
728
724
. aggregate ( [ { $project : { a : 1 } } , { $group : { _id : '$a' } } ] )
729
- . explain ( 'allPlansExecution' , ( err , result ) => {
725
+ . explain ( 'allPlansExecution' , ( err , res ) => {
730
726
expect ( err ) . to . not . exist ;
731
- expect ( result ) . to . exist ;
732
- expect ( result ) . to . have . property ( 'stages' ) ;
733
- expect ( result . stages ) . to . have . lengthOf . at . least ( 1 ) ;
734
- expect ( result . stages [ 0 ] ) . to . have . property ( '$cursor' ) ;
735
- expect ( result . stages [ 0 ] . $cursor ) . to . have . property ( 'queryPlanner' ) ;
736
- expect ( result . stages [ 0 ] . $cursor ) . to . have . property ( 'executionStats' ) ;
727
+ expect ( res ) . to . exist ;
728
+ const result = JSON . stringify ( res ) ;
729
+ expect ( result ) . to . include ( '"queryPlanner"' ) ;
730
+ expect ( result ) . to . include ( '"executionStats"' ) ;
737
731
done ( ) ;
738
732
} ) ;
739
733
} ) ;
@@ -752,11 +746,11 @@ describe('Explain', function () {
752
746
753
747
collection
754
748
. aggregate ( [ { $project : { a : 1 } } , { $group : { _id : '$a' } } ] )
755
- . explain ( ( err , result ) => {
749
+ . explain ( ( err , res ) => {
756
750
expect ( err ) . to . not . exist ;
757
- expect ( result ) . to . have . property ( 'stages' ) ;
758
- expect ( result . stages ) . to . have . lengthOf . at . least ( 1 ) ;
759
- expect ( result . stages [ 0 ] ) . to . have . property ( '$cursor ') ;
751
+ const result = JSON . stringify ( res ) ;
752
+ expect ( result ) . to . include ( '"queryPlanner"' ) ;
753
+ expect ( result ) . to . include ( '"executionStats" ') ;
760
754
done ( ) ;
761
755
} ) ;
762
756
} ) ;
0 commit comments