@@ -31,7 +31,7 @@ describe('Connection', function () {
31
31
return setupDatabase ( this . configuration ) ;
32
32
} ) ;
33
33
34
- describe ( 'Connection - functional/cmap ' , function ( ) {
34
+ describe ( 'Connection.command ' , function ( ) {
35
35
it ( 'should execute a command against a server' , {
36
36
metadata : { requires : { apiVersion : false , topology : '!load-balanced' } } ,
37
37
test : async function ( ) {
@@ -79,66 +79,6 @@ describe('Connection', function () {
79
79
}
80
80
}
81
81
} ) ;
82
-
83
- it ( 'should support calling back multiple times on exhaust commands' , {
84
- metadata : {
85
- requires : { apiVersion : false , mongodb : '>=4.2.0' , topology : [ 'single' ] }
86
- } ,
87
- test : function ( done ) {
88
- const namespace = ns ( `${ this . configuration . db } .$cmd` ) ;
89
- const connectOptions : Partial < ConnectionOptions > = {
90
- connectionType : Connection ,
91
- ...this . configuration . options ,
92
- metadata : makeClientMetadata ( { driverInfo : { } } )
93
- } ;
94
-
95
- connect ( connectOptions as any as ConnectionOptions , ( err , conn ) => {
96
- expect ( err ) . to . not . exist ;
97
- this . defer ( _done => conn . destroy ( _done ) ) ;
98
-
99
- const documents = Array . from ( Array ( 10000 ) , ( _ , idx ) => ( {
100
- test : Math . floor ( Math . random ( ) * idx )
101
- } ) ) ;
102
-
103
- conn . command ( namespace , { drop : 'test' } , undefined , ( ) => {
104
- conn . command ( namespace , { insert : 'test' , documents } , undefined , ( err , res ) => {
105
- expect ( err ) . to . not . exist ;
106
- expect ( res ) . nested . property ( 'n' ) . to . equal ( documents . length ) ;
107
-
108
- let totalDocumentsRead = 0 ;
109
- conn . command (
110
- namespace ,
111
- { find : 'test' , batchSize : 100 } ,
112
- undefined ,
113
- ( err , result ) => {
114
- expect ( err ) . to . not . exist ;
115
- expect ( result ) . nested . property ( 'cursor' ) . to . exist ;
116
- const cursor = result . cursor ;
117
- totalDocumentsRead += cursor . firstBatch . length ;
118
-
119
- conn . command (
120
- namespace ,
121
- { getMore : cursor . id , collection : 'test' , batchSize : 100 } ,
122
- { exhaustAllowed : true } ,
123
- ( err , result ) => {
124
- expect ( err ) . to . not . exist ;
125
- expect ( result ) . nested . property ( 'cursor' ) . to . exist ;
126
- const cursor = result . cursor ;
127
- totalDocumentsRead += cursor . nextBatch . length ;
128
-
129
- if ( cursor . id === 0 || cursor . id . isZero ( ) ) {
130
- expect ( totalDocumentsRead ) . to . equal ( documents . length ) ;
131
- done ( ) ;
132
- }
133
- }
134
- ) ;
135
- }
136
- ) ;
137
- } ) ;
138
- } ) ;
139
- } ) ;
140
- }
141
- } ) ;
142
82
} ) ;
143
83
144
84
describe ( 'Connection - functional' , function ( ) {
0 commit comments