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
28942f4c
Commit
28942f4c
authored
Dec 02, 2016
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-229: Count and Distinct don't need Server to construct commands
This should have been done in
8dcc7784
.
parent
95b61909
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
+4
-6
Count.php
src/Operation/Count.php
+2
-3
Distinct.php
src/Operation/Distinct.php
+2
-3
No files found.
src/Operation/Count.php
View file @
28942f4c
...
@@ -130,7 +130,7 @@ class Count implements Executable
...
@@ -130,7 +130,7 @@ class Count implements Executable
$readPreference
=
isset
(
$this
->
options
[
'readPreference'
])
?
$this
->
options
[
'readPreference'
]
:
null
;
$readPreference
=
isset
(
$this
->
options
[
'readPreference'
])
?
$this
->
options
[
'readPreference'
]
:
null
;
$cursor
=
$server
->
executeCommand
(
$this
->
databaseName
,
$this
->
createCommand
(
$server
),
$readPreference
);
$cursor
=
$server
->
executeCommand
(
$this
->
databaseName
,
$this
->
createCommand
(),
$readPreference
);
$result
=
current
(
$cursor
->
toArray
());
$result
=
current
(
$cursor
->
toArray
());
// Older server versions may return a float
// Older server versions may return a float
...
@@ -144,10 +144,9 @@ class Count implements Executable
...
@@ -144,10 +144,9 @@ class Count implements Executable
/**
/**
* Create the count command.
* Create the count command.
*
*
* @param Server $server
* @return Command
* @return Command
*/
*/
private
function
createCommand
(
Server
$server
)
private
function
createCommand
()
{
{
$cmd
=
[
'count'
=>
$this
->
collectionName
];
$cmd
=
[
'count'
=>
$this
->
collectionName
];
...
...
src/Operation/Distinct.php
View file @
28942f4c
...
@@ -120,10 +120,9 @@ class Distinct implements Executable
...
@@ -120,10 +120,9 @@ class Distinct implements Executable
/**
/**
* Create the distinct command.
* Create the distinct command.
*
*
* @param Server $server
* @return Command
* @return Command
*/
*/
private
function
createCommand
(
Server
$server
)
private
function
createCommand
()
{
{
$cmd
=
[
$cmd
=
[
'distinct'
=>
$this
->
collectionName
,
'distinct'
=>
$this
->
collectionName
,
...
@@ -142,7 +141,7 @@ class Distinct implements Executable
...
@@ -142,7 +141,7 @@ class Distinct implements Executable
$cmd
[
'maxTimeMS'
]
=
$this
->
options
[
'maxTimeMS'
];
$cmd
[
'maxTimeMS'
]
=
$this
->
options
[
'maxTimeMS'
];
}
}
if
(
isset
(
$this
->
options
[
'readConcern'
])
&&
\MongoDB\server_supports_feature
(
$server
,
self
::
$wireVersionForReadConcern
)
)
{
if
(
isset
(
$this
->
options
[
'readConcern'
]))
{
$cmd
[
'readConcern'
]
=
\MongoDB\read_concern_as_document
(
$this
->
options
[
'readConcern'
]);
$cmd
[
'readConcern'
]
=
\MongoDB\read_concern_as_document
(
$this
->
options
[
'readConcern'
]);
}
}
...
...
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