@@ -243,13 +243,10 @@ private function executeForClient(Client $client)
243
243
244
244
switch ($ this ->name ) {
245
245
case 'createChangeStream ' :
246
- $ changeStream = $ client ->watch (
246
+ return $ client ->watch (
247
247
$ args ['pipeline ' ],
248
248
array_diff_key ($ args , ['pipeline ' => 1 ])
249
249
);
250
- $ changeStream ->rewind ();
251
-
252
- return $ changeStream ;
253
250
case 'listDatabaseNames ' :
254
251
return iterator_to_array ($ client ->listDatabaseNames ($ args ));
255
252
case 'listDatabases ' :
@@ -275,13 +272,10 @@ private function executeForCollection(Collection $collection)
275
272
array_diff_key ($ args , ['requests ' => 1 ])
276
273
);
277
274
case 'createChangeStream ' :
278
- $ changeStream = $ collection ->watch (
275
+ return $ collection ->watch (
279
276
$ args ['pipeline ' ],
280
277
array_diff_key ($ args , ['pipeline ' => 1 ])
281
278
);
282
- $ changeStream ->rewind ();
283
-
284
- return $ changeStream ;
285
279
case 'createIndex ' :
286
280
return $ collection ->createIndex (
287
281
$ args ['keys ' ],
@@ -401,13 +395,10 @@ private function executeForDatabase(Database $database)
401
395
array_diff_key ($ args , ['pipeline ' => 1 ])
402
396
));
403
397
case 'createChangeStream ' :
404
- $ changeStream = $ database ->watch (
398
+ return $ database ->watch (
405
399
$ args ['pipeline ' ],
406
400
array_diff_key ($ args , ['pipeline ' => 1 ])
407
401
);
408
- $ changeStream ->rewind ();
409
-
410
- return $ changeStream ;
411
402
case 'createCollection ' :
412
403
return $ database ->createCollection (
413
404
$ args ['collection ' ],
0 commit comments