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
ed5567a1
Commit
ed5567a1
authored
Feb 02, 2018
by
Katherine Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-304: Deprecate methods and classes related to inline results for the aggregate command
parent
0d84061d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
18 deletions
+3
-18
Aggregate.php
src/Operation/Aggregate.php
+3
-14
AggregateFunctionalTest.php
tests/Operation/AggregateFunctionalTest.php
+0
-4
No files found.
src/Operation/Aggregate.php
View file @
ed5567a1
...
...
@@ -41,7 +41,6 @@ use Traversable;
class
Aggregate
implements
Executable
{
private
static
$wireVersionForCollation
=
5
;
private
static
$wireVersionForCursor
=
2
;
private
static
$wireVersionForDocumentLevelValidation
=
4
;
private
static
$wireVersionForReadConcern
=
4
;
private
static
$wireVersionForWriteConcern
=
5
;
...
...
@@ -100,9 +99,6 @@ class Aggregate implements Executable
* * useCursor (boolean): Indicates whether the command will request that
* the server provide results using a cursor. The default is true.
*
* For servers < 2.6, this option is ignored as aggregation cursors are
* not available.
*
* For servers >= 2.6, this option allows users to turn off cursors if
* necessary to aid in mongod/mongos upgrades.
*
...
...
@@ -238,16 +234,15 @@ class Aggregate implements Executable
}
$hasOutStage
=
\MongoDB\is_last_pipeline_operator_out
(
$this
->
pipeline
);
$isCursorSupported
=
\MongoDB\server_supports_feature
(
$server
,
self
::
$wireVersionForCursor
);
$command
=
$this
->
createCommand
(
$server
,
$isCursorSupported
);
$command
=
$this
->
createCommand
(
$server
);
$options
=
$this
->
createOptions
(
$hasOutStage
);
$cursor
=
$hasOutStage
?
$server
->
executeReadWriteCommand
(
$this
->
databaseName
,
$command
,
$options
)
:
$server
->
executeReadCommand
(
$this
->
databaseName
,
$command
,
$options
);
if
(
$
isCursorSupported
&&
$
this
->
options
[
'useCursor'
])
{
if
(
$this
->
options
[
'useCursor'
])
{
if
(
isset
(
$this
->
options
[
'typeMap'
]))
{
$cursor
->
setTypeMap
(
$this
->
options
[
'typeMap'
]);
}
...
...
@@ -272,10 +267,9 @@ class Aggregate implements Executable
* Create the aggregate command.
*
* @param Server $server
* @param boolean $isCursorSupported
* @return Command
*/
private
function
createCommand
(
Server
$server
,
$isCursorSupported
)
private
function
createCommand
(
Server
$server
)
{
$cmd
=
[
'aggregate'
=>
$this
->
collectionName
,
...
...
@@ -283,11 +277,6 @@ class Aggregate implements Executable
];
$cmdOptions
=
[];
// Servers < 2.6 do not support any command options
if
(
!
$isCursorSupported
)
{
return
new
Command
(
$cmd
);
}
$cmd
[
'allowDiskUse'
]
=
$this
->
options
[
'allowDiskUse'
];
if
(
isset
(
$this
->
options
[
'bypassDocumentValidation'
])
&&
\MongoDB\server_supports_feature
(
$server
,
self
::
$wireVersionForDocumentLevelValidation
))
{
...
...
tests/Operation/AggregateFunctionalTest.php
View file @
ed5567a1
...
...
@@ -30,10 +30,6 @@ class AggregateFunctionalTest extends FunctionalTestCase
public
function
testDefaultWriteConcernIsOmitted
()
{
if
(
version_compare
(
$this
->
getServerVersion
(),
'2.6.0'
,
'<'
))
{
$this
->
markTestSkipped
(
'$out pipeline operator is not supported'
);
}
(
new
CommandObserver
)
->
observe
(
function
()
{
$operation
=
new
Aggregate
(
...
...
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