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
cab405d6
Commit
cab405d6
authored
Jun 17, 2015
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Aggregate should check server support before returning a cursor
parent
26078fe2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
Aggregate.php
src/Operation/Aggregate.php
+8
-5
No files found.
src/Operation/Aggregate.php
View file @
cab405d6
...
...
@@ -113,10 +113,12 @@ class Aggregate implements Executable
*/
public
function
execute
(
Server
$server
)
{
$command
=
$this
->
createCommand
(
$server
);
$isCursorSupported
=
\MongoDB\server_supports_feature
(
$server
,
self
::
$wireVersionForCursor
);
$command
=
$this
->
createCommand
(
$server
,
$isCursorSupported
);
$cursor
=
$server
->
executeCommand
(
$this
->
databaseName
,
$command
);
if
(
$this
->
options
[
'useCursor'
])
{
if
(
$
isCursorSupported
&&
$
this
->
options
[
'useCursor'
])
{
return
$cursor
;
}
...
...
@@ -140,9 +142,10 @@ class Aggregate implements Executable
* Create the aggregate command.
*
* @param Server $server
* @param boolean $isCursorSupported
* @return Command
*/
private
function
createCommand
(
Server
$server
)
private
function
createCommand
(
Server
$server
,
$isCursorSupported
)
{
$cmd
=
array
(
'aggregate'
=>
$this
->
collectionName
,
...
...
@@ -150,7 +153,7 @@ class Aggregate implements Executable
);
// Servers < 2.6 do not support any command options
if
(
!
\MongoDB\server_supports_feature
(
$server
,
self
::
$wireVersionForCursor
)
)
{
if
(
!
$isCursorSupported
)
{
return
new
Command
(
$cmd
);
}
...
...
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