@@ -538,7 +538,7 @@ exports.shouldCreateComplexIndexOnTwoFields = {
538
538
test . equal ( 4 , items . length ) ;
539
539
540
540
// Peform a query, with explain to show we hit the query
541
- collection . find ( { a :2 } , { explain : true } ) . toArray ( function ( err , explanation ) {
541
+ collection . find ( { a :2 } ) . explain ( function ( err , explanation ) {
542
542
test . equal ( null , err ) ;
543
543
test . ok ( explanation != null ) ;
544
544
@@ -586,7 +586,7 @@ exports.shouldCreateASimpleIndexOnASingleField = {
586
586
test . equal ( "a_1" , indexName ) ;
587
587
588
588
// Peform a query, with explain to show we hit the query
589
- collection . find ( { a :2 } , { explain : true } ) . toArray ( function ( err , explanation ) {
589
+ collection . find ( { a :2 } ) . explain ( function ( err , explanation ) {
590
590
test . equal ( null , err ) ;
591
591
test . ok ( explanation != null ) ;
592
592
@@ -641,7 +641,7 @@ exports.createIndexExample3 = {
641
641
test . equal ( 4 , items . length ) ;
642
642
643
643
// Peform a query, with explain to show we hit the query
644
- collection . find ( { a :2 } , { explain : true } ) . toArray ( function ( err , explanation ) {
644
+ collection . find ( { a :2 } ) . explain ( function ( err , explanation ) {
645
645
test . equal ( null , err ) ;
646
646
test . ok ( explanation != null ) ;
647
647
@@ -925,7 +925,7 @@ exports.shouldCreateComplexEnsureIndex = {
925
925
test . equal ( 4 , items . length ) ;
926
926
927
927
// Peform a query, with explain to show we hit the query
928
- collection . find ( { a :2 } , { explain : true } ) . toArray ( function ( err , explanation ) {
928
+ collection . find ( { a :2 } ) . explain ( function ( err , explanation ) {
929
929
test . equal ( null , err ) ;
930
930
test . ok ( explanation != null ) ;
931
931
@@ -978,7 +978,7 @@ exports.ensureIndexExampleWithCompountIndex = {
978
978
test . equal ( 4 , items . length ) ;
979
979
980
980
// Peform a query, with explain to show we hit the query
981
- collection . find ( { a :2 } , { explain : true } ) . toArray ( function ( err , explanation ) {
981
+ collection . find ( { a :2 } ) . explain ( function ( err , explanation ) {
982
982
test . equal ( null , err ) ;
983
983
test . ok ( explanation != null ) ;
984
984
@@ -1065,9 +1065,9 @@ exports.shouldPeformASimpleExplainQuery = {
1065
1065
test . equal ( null , err ) ;
1066
1066
1067
1067
// Peform a simple find and return all the documents
1068
- collection . find ( { } , { explain : true } ) . toArray ( function ( err , docs ) {
1068
+ collection . find ( { } ) . explain ( function ( err , explain ) {
1069
1069
test . equal ( null , err ) ;
1070
- test . equal ( 1 , docs . length ) ;
1070
+ test . ok ( explain != null ) ;
1071
1071
1072
1072
db . close ( ) ;
1073
1073
test . done ( ) ;
@@ -1107,14 +1107,15 @@ exports.shouldPeformASimpleLimitSkipQuery = {
1107
1107
test . equal ( null , err ) ;
1108
1108
1109
1109
// Peform a simple find and return all the documents
1110
- collection . find ( { } , { skip :1 , limit :1 , fields :{ b :1 } } ) . toArray ( function ( err , docs ) {
1111
- test . equal ( null , err ) ;
1112
- test . equal ( 1 , docs . length ) ;
1113
- test . equal ( null , docs [ 0 ] . a ) ;
1114
- test . equal ( 2 , docs [ 0 ] . b ) ;
1110
+ collection . find ( { } )
1111
+ . skip ( 1 ) . limit ( 1 ) . project ( { b :1 } ) . toArray ( function ( err , docs ) {
1112
+ test . equal ( null , err ) ;
1113
+ test . equal ( 1 , docs . length ) ;
1114
+ test . equal ( null , docs [ 0 ] . a ) ;
1115
+ test . equal ( 2 , docs [ 0 ] . b ) ;
1115
1116
1116
- db . close ( ) ;
1117
- test . done ( ) ;
1117
+ db . close ( ) ;
1118
+ test . done ( ) ;
1118
1119
} ) ;
1119
1120
} ) ;
1120
1121
} ) ;
@@ -3790,7 +3791,7 @@ exports.shouldCreateOnDbComplexIndexOnTwoFields = {
3790
3791
test . equal ( 4 , items . length ) ;
3791
3792
3792
3793
// Peform a query, with explain to show we hit the query
3793
- collection . find ( { a :2 } , { explain : true } ) . toArray ( function ( err , explanation ) {
3794
+ collection . find ( { a :2 } ) . explain ( function ( err , explanation ) {
3794
3795
test . equal ( null , err ) ;
3795
3796
test . ok ( explanation != null ) ;
3796
3797
@@ -3844,7 +3845,7 @@ exports.shouldCreateComplexEnsureIndexDb = {
3844
3845
test . equal ( 4 , items . length ) ;
3845
3846
3846
3847
// Peform a query, with explain to show we hit the query
3847
- collection . find ( { a :2 } , { explain : true } ) . toArray ( function ( err , explanation ) {
3848
+ collection . find ( { a :2 } ) . explain ( function ( err , explanation ) {
3848
3849
test . equal ( null , err ) ;
3849
3850
test . ok ( explanation != null ) ;
3850
3851
0 commit comments