Commit 343a9a45 authored by Katherine Walker's avatar Katherine Walker

PHPLIB-310: Add pipeline stage to ChangeStreams example for Docs

parent 11ab5dac
...@@ -925,7 +925,7 @@ class DocumentationExamplesTest extends FunctionalTestCase ...@@ -925,7 +925,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this->assertInventoryCount(0); $this->assertInventoryCount(0);
} }
public function testChangeStreamExample_1_3() public function testChangeStreamExample_1_4()
{ {
if (version_compare($this->getFeatureCompatibilityVersion(), '3.6', '<')) { if (version_compare($this->getFeatureCompatibilityVersion(), '3.6', '<')) {
$this->markTestSkipped('$changeStream is only supported on FCV 3.6 or higher'); $this->markTestSkipped('$changeStream is only supported on FCV 3.6 or higher');
...@@ -981,6 +981,12 @@ class DocumentationExamplesTest extends FunctionalTestCase ...@@ -981,6 +981,12 @@ class DocumentationExamplesTest extends FunctionalTestCase
'documentKey' => (object) ['_id' => $insertedId] 'documentKey' => (object) ['_id' => $insertedId]
]; ];
$this->assertEquals($cursor->current(), $expectedChange); $this->assertEquals($cursor->current(), $expectedChange);
// Start Changestream Example 4
$pipeline = [['$match' => ['$or' => [['fullDocument.username' => 'alice'], ['operationType' => 'delete']]]]];
$cursor = $db->inventory->watch($pipeline, []);
$cursor->next();
// End Changestream Example 4
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment