@@ -243,13 +243,10 @@ private function executeForClient(Client $client)
243243
244244 switch ($ this ->name ) {
245245 case 'createChangeStream ' :
246- $ changeStream = $ client ->watch (
246+ return $ client ->watch (
247247 $ args ['pipeline ' ],
248248 array_diff_key ($ args , ['pipeline ' => 1 ])
249249 );
250- $ changeStream ->rewind ();
251-
252- return $ changeStream ;
253250 case 'listDatabaseNames ' :
254251 return iterator_to_array ($ client ->listDatabaseNames ($ args ));
255252 case 'listDatabases ' :
@@ -275,13 +272,10 @@ private function executeForCollection(Collection $collection)
275272 array_diff_key ($ args , ['requests ' => 1 ])
276273 );
277274 case 'createChangeStream ' :
278- $ changeStream = $ collection ->watch (
275+ return $ collection ->watch (
279276 $ args ['pipeline ' ],
280277 array_diff_key ($ args , ['pipeline ' => 1 ])
281278 );
282- $ changeStream ->rewind ();
283-
284- return $ changeStream ;
285279 case 'createIndex ' :
286280 return $ collection ->createIndex (
287281 $ args ['keys ' ],
@@ -401,13 +395,10 @@ private function executeForDatabase(Database $database)
401395 array_diff_key ($ args , ['pipeline ' => 1 ])
402396 ));
403397 case 'createChangeStream ' :
404- $ changeStream = $ database ->watch (
398+ return $ database ->watch (
405399 $ args ['pipeline ' ],
406400 array_diff_key ($ args , ['pipeline ' => 1 ])
407401 );
408- $ changeStream ->rewind ();
409-
410- return $ changeStream ;
411402 case 'createCollection ' :
412403 return $ database ->createCollection (
413404 $ args ['collection ' ],
0 commit comments