Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-php-library
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
mongo-php-library
Commits
7d7a5bad
Commit
7d7a5bad
authored
Feb 05, 2018
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-302: Support session option for change streams
parent
e85d3b37
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
apiargs-MongoDBCollection-method-watch-option.yaml
...cludes/apiargs-MongoDBCollection-method-watch-option.yaml
+4
-0
Watch.php
src/Operation/Watch.php
+5
-5
WatchTest.php
tests/Operation/WatchTest.php
+4
-0
No files found.
docs/includes/apiargs-MongoDBCollection-method-watch-option.yaml
View file @
7d7a5bad
...
...
@@ -66,4 +66,8 @@ description: |
interface
:
phpmethod
operation
:
~
optional
:
true
---
source
:
file
:
apiargs-common-option.yaml
ref
:
session
...
src/Operation/Watch.php
View file @
7d7a5bad
...
...
@@ -67,10 +67,6 @@ class Watch implements Executable
* Insert and replace operations always include the "fullDocument" field
* and delete operations omit the field as the document no longer exists.
*
* * session (MongoDB\Driver\Session): Client session.
*
* Sessions are not supported for server versions < 3.6.
*
* * maxAwaitTimeMS (integer): The maximum amount of time for the server to
* wait on new documents to satisfy a change stream query.
*
...
...
@@ -83,6 +79,10 @@ class Watch implements Executable
* * resumeAfter (document): Specifies the logical starting point for the
* new change stream.
*
* * session (MongoDB\Driver\Session): Client session.
*
* Sessions are not supported for server versions < 3.6.
*
* @param string $databaseName Database name
* @param string $collectionName Collection name
* @param array $pipeline List of pipeline operations
...
...
@@ -148,7 +148,7 @@ class Watch implements Executable
$pipeline
=
$this
->
pipeline
;
array_unshift
(
$pipeline
,
$changeStream
);
$aggregateOptions
=
array_intersect_key
(
$this
->
options
,
[
'batchSize'
=>
1
,
'collation'
=>
1
,
'maxAwaitTimeMS'
=>
1
,
'readConcern'
=>
1
,
'readPreference'
=>
1
]);
$aggregateOptions
=
array_intersect_key
(
$this
->
options
,
[
'batchSize'
=>
1
,
'collation'
=>
1
,
'maxAwaitTimeMS'
=>
1
,
'readConcern'
=>
1
,
'readPreference'
=>
1
,
'session'
=>
1
]);
return
new
Aggregate
(
$this
->
databaseName
,
$this
->
collectionName
,
$pipeline
,
$aggregateOptions
);
}
...
...
tests/Operation/WatchTest.php
View file @
7d7a5bad
...
...
@@ -63,6 +63,10 @@ class WatchTest extends FunctionalTestCase
$options
[][]
=
[
'resumeAfter'
=>
$value
];
}
foreach
(
$this
->
getInvalidSessionValues
()
as
$value
)
{
$options
[][]
=
[
'session'
=>
$value
];
}
return
$options
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment