@@ -935,62 +935,62 @@ public function testChangeStreamExample_1_4()
935
935
$ db = new Database ($ this ->manager , $ this ->getDatabaseName ());
936
936
937
937
// Start Changestream Example 1
938
- $ cursor = $ db ->inventory ->watch ();
939
- $ cursor ->next ();
940
- $ current = $ cursor ->current ();
938
+ $ changeStream = $ db ->inventory ->watch ();
939
+ $ changeStream ->next ();
940
+ $ document = $ changeStream ->current ();
941
941
// End Changestream Example 1
942
942
943
- $ this ->assertNull ($ current );
943
+ $ this ->assertNull ($ document );
944
944
945
945
// Start Changestream Example 2
946
- $ cursor = $ db ->inventory ->watch ([], ['fullDocument ' => \MongoDB \Operation \Watch::FULL_DOCUMENT_UPDATE_LOOKUP ]);
947
- $ cursor ->next ();
948
- $ current = $ cursor ->current ();
946
+ $ changeStream = $ db ->inventory ->watch ([], ['fullDocument ' => \MongoDB \Operation \Watch::FULL_DOCUMENT_UPDATE_LOOKUP ]);
947
+ $ changeStream ->next ();
948
+ $ document = $ changeStream ->current ();
949
949
// End Changestream Example 2
950
950
951
- $ this ->assertNull ($ current );
951
+ $ this ->assertNull ($ document );
952
952
953
953
$ insertedResult = $ db ->inventory ->insertOne (['x ' => 1 ]);
954
954
$ insertedId = $ insertedResult ->getInsertedId ();
955
- $ cursor ->next ();
956
- $ current = $ cursor ->current ();
955
+ $ changeStream ->next ();
956
+ $ document = $ changeStream ->current ();
957
957
958
958
$ expectedChange = [
959
- '_id ' => $ current ->_id ,
959
+ '_id ' => $ document ->_id ,
960
960
'operationType ' => 'insert ' ,
961
961
'fullDocument ' => ['_id ' => $ insertedId , 'x ' => 1 ],
962
962
'ns ' => ['db ' => $ this ->getDatabaseName (), 'coll ' => 'inventory ' ],
963
963
'documentKey ' => ['_id ' => $ insertedId ],
964
964
];
965
965
966
- $ this ->assertSameDocument ($ expectedChange , $ current );
966
+ $ this ->assertSameDocument ($ expectedChange , $ document );
967
967
968
968
// Start Changestream Example 3
969
- $ resumeToken = ($ current !== null ) ? $ current ->_id : null ;
969
+ $ resumeToken = ($ document !== null ) ? $ document ->_id : null ;
970
970
if ($ resumeToken !== null ) {
971
- $ cursor = $ db ->inventory ->watch ([], ['resumeAfter ' => $ resumeToken ]);
972
- $ cursor ->next ();
971
+ $ changeStream = $ db ->inventory ->watch ([], ['resumeAfter ' => $ resumeToken ]);
972
+ $ changeStream ->next ();
973
973
}
974
974
// End Changestream Example 3
975
975
976
976
$ insertedResult = $ db ->inventory ->insertOne (['x ' => 2 ]);
977
977
$ insertedId = $ insertedResult ->getInsertedId ();
978
- $ cursor ->next ();
978
+ $ changeStream ->next ();
979
979
980
980
$ expectedChange = [
981
- '_id ' => $ cursor ->current ()->_id ,
981
+ '_id ' => $ changeStream ->current ()->_id ,
982
982
'operationType ' => 'insert ' ,
983
983
'fullDocument ' => ['_id ' => $ insertedId , 'x ' => 2 ],
984
984
'ns ' => ['db ' => $ this ->getDatabaseName (), 'coll ' => 'inventory ' ],
985
985
'documentKey ' => ['_id ' => $ insertedId ],
986
986
];
987
987
988
- $ this ->assertSameDocument ($ expectedChange , $ cursor ->current ());
988
+ $ this ->assertSameDocument ($ expectedChange , $ changeStream ->current ());
989
989
990
990
// Start Changestream Example 4
991
991
$ pipeline = [['$match ' => ['$or ' => [['fullDocument.username ' => 'alice ' ], ['operationType ' => 'delete ' ]]]]];
992
- $ cursor = $ db ->inventory ->watch ($ pipeline, [] );
993
- $ cursor ->next ();
992
+ $ changeStream = $ db ->inventory ->watch ($ pipeline );
993
+ $ changeStream ->next ();
994
994
// End Changestream Example 4
995
995
}
996
996
0 commit comments